Skip to content

Commit

Permalink
Fix DatePeriod tests for implementing IteratorAggregate
Browse files Browse the repository at this point in the history
I wrote them in a wrong way in vimeo#8312, so they are rewritten now as @AndrolGenhald advised in vimeo#8327
  • Loading branch information
fluffycondor committed Aug 19, 2022
1 parent 7ee3a81 commit 1ee1d40
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions tests/CoreStubsTest.php
Expand Up @@ -86,23 +86,21 @@ public function providerValidCodeParse(): iterable
'error_levels' => [],
'php_version' => '8.0',
];
yield 'DatePeriod implements only Traversable on PHP 7' => [
'<?php
$period = new DatePeriod("R4/2012-07-01T00:00:00Z/P7D");
if ($period instanceof IteratorAggregate) {}',
'assertions' => [],
'error_levels' => [],
'php_version' => '7.3',
];
yield 'DatePeriod implements IteratorAggregate on PHP 8' => [
'<?php
$period = new DatePeriod("R4/2012-07-01T00:00:00Z/P7D");
if ($period instanceof IteratorAggregate) {}',
'assertions' => [],
'error_levels' => ['RedundantCondition'],
$iterator = $period->getIterator();',
'assertions' => ['$iterator' => 'Traversable<int, DateTime>&Iterator'],
'error_levels' => [],
'php_version' => '8.0',
];
yield 'DatePeriod implements only Traversable on PHP 7' => [
'<?php
$period = new DatePeriod("R4/2012-07-01T00:00:00Z/P7D");
$iterator = $period->getIterator();',
'assertions' => ['$iterator' => 'Traversable<empty, empty>'],
'error_levels' => [],
'php_version' => '7.3',
];
}
}

0 comments on commit 1ee1d40

Please sign in to comment.