Skip to content

Commit

Permalink
Skip date tests when libicu is >= 72
Browse files Browse the repository at this point in the history
  • Loading branch information
n-peugnet authored and vincent-peugnet committed May 5, 2024
1 parent 00c1ae3 commit 9f3eb16
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 18 deletions.
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ parameters:
- tests
excludePaths:
- app/view/*
dynamicConstantNames:
- INTL_ICU_VERSION
exceptionRules:
# ignore some exceptions and their chlidrens
uncheckedExceptions:
Expand Down
32 changes: 23 additions & 9 deletions tests/Servicerenderv1Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,8 @@ public function tearDown(): void
parent::tearDown();
}

/**
* @test
* @dataProvider renderProvider
*/
public function renderTest(string $name, bool $requireslinux = false): void
public function renderTest(string $name): void
{
if ($requireslinux && PHP_OS_FAMILY != 'Linux') {
$this->markTestSkipped();
}
$pagedata = json_decode(file_get_contents(__DIR__ . "/data/Servicerenderv1Test/$name.json"), true);
$page = new Pagev1($pagedata);
$html = $this->renderengine->render($page);
Expand All @@ -67,15 +60,36 @@ public function renderTest(string $name, bool $requireslinux = false): void
$this->assertFileEquals($expected, $actual, "$actual render does not match expected $expected");
}

/**
* @test
* @dataProvider renderProvider
*/
public function renderTestCommon(string $name): void
{
$this->renderTest($name);
}

public function renderProvider(): array
{
return [
['empty-test'],
['markdown-test'],
['markdown-test-2'],
['body-test'],
['date-time-test', true],
['external-links-test'],
];
}

/**
* @test
* @requires OS Linux
* @requires extension intl
*/
public function renderTestDate(): void
{
if (floatval(INTL_ICU_VERSION) >= 72) {
$this->markTestSkipped();
}
$this->renderTest('date-time-test');
}
}
32 changes: 23 additions & 9 deletions tests/Servicerenderv2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,8 @@ public function tearDown(): void
parent::tearDown();
}

/**
* @test
* @dataProvider renderProvider
*/
public function renderTest(string $name, bool $requireslinux = false): void
public function renderTest(string $name): void
{
if ($requireslinux && PHP_OS_FAMILY != 'Linux') {
$this->markTestSkipped();
}
$pagedata = json_decode(file_get_contents(__DIR__ . "/data/Servicerenderv2Test/$name.json"), true);
$page = new Pagev2($pagedata);
$html = $this->renderengine->render($page);
Expand All @@ -67,14 +60,35 @@ public function renderTest(string $name, bool $requireslinux = false): void
$this->assertFileEquals($expected, $actual, "$actual render does not match expected $expected");
}

/**
* @test
* @dataProvider renderProvider
*/
public function renderTestCommon(string $name): void
{
$this->renderTest($name);
}

public function renderProvider(): array
{
return [
['empty-test-v2'],
['markdown-test-v2'],
['body-test-v2'],
['date-time-test-v2', true],
['external-links-test-v2'],
];
}

/**
* @test
* @requires OS Linux
* @requires extension intl
*/
public function renderTestDate(): void
{
if (floatval(INTL_ICU_VERSION) >= 72) {
$this->markTestSkipped();
}
$this->renderTest('date-time-test-v2');
}
}

0 comments on commit 9f3eb16

Please sign in to comment.