You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
911 B
30 lines
911 B
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Services\Crawl\ArxivMetadataParser;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class ArxivMetadataParserTest extends TestCase
|
|
{
|
|
public function test_parses_citation_meta_and_submission_history(): void
|
|
{
|
|
$html = <<<'HTML'
|
|
<meta name="citation_date" content="2026/04/09" />
|
|
<div class="dateline">[Submitted on 9 Apr 2026]</div>
|
|
<div class="submission-history">
|
|
<h2>Submission history</h2>
|
|
<strong>[v1]</strong> Thu, 9 Apr 2026 06:52:51 UTC (1,821 KB)<br/>
|
|
</div>
|
|
HTML;
|
|
|
|
$this->assertSame('2026-04-09', ArxivMetadataParser::parsePublishedDate($html));
|
|
}
|
|
|
|
public function test_parses_published_date_from_arxiv_id(): void
|
|
{
|
|
$this->assertSame('2026-06-01', ArxivMetadataParser::parsePublishedDateFromArxivId('2606.23690'));
|
|
$this->assertSame('2026-06-01', ArxivMetadataParser::parsePublishedDateFromArxivId('2606.23690v1'));
|
|
}
|
|
}
|