From 0da28da67b2592323ed1dd36244744c5bea97721 Mon Sep 17 00:00:00 2001 From: Semyon <7ionmail@gmail.com> Date: Fri, 19 Aug 2022 14:52:22 +0300 Subject: [PATCH] Fix DatePeriod tests for implementing IteratorAggregate I wrote them in a wrong way in #8312, so they are rewritten now as @AndrolGenhald advised in #8327 --- tests/CoreStubsTest.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/tests/CoreStubsTest.php b/tests/CoreStubsTest.php index d6f0a85a916..cc23f5ddfbc 100644 --- a/tests/CoreStubsTest.php +++ b/tests/CoreStubsTest.php @@ -2,11 +2,13 @@ namespace Psalm\Tests; +use Psalm\Tests\Traits\InvalidCodeAnalysisTestTrait; use Psalm\Tests\Traits\ValidCodeAnalysisTestTrait; class CoreStubsTest extends TestCase { use ValidCodeAnalysisTestTrait; + use InvalidCodeAnalysisTestTrait; /** * @return iterable,error_levels?:string[]}> @@ -86,23 +88,29 @@ public function providerValidCodeParse(): iterable 'error_levels' => [], 'php_version' => '8.0', ]; - yield 'DatePeriod implements only Traversable on PHP 7' => [ + yield 'DatePeriod implements IteratorAggregate on PHP 8' => [ 'getIterator();', 'assertions' => [], 'error_levels' => [], - 'php_version' => '7.3', + 'php_version' => '8.0', ]; - yield 'DatePeriod implements IteratorAggregate on PHP 8' => [ - ' + */ + public function providerInvalidCodeParse(): iterable + { + yield 'DatePeriod implements only Traversable on PHP 7' => [ + ' [], - 'error_levels' => ['RedundantCondition'], - 'php_version' => '8.0', + $period->getIterator();', + 'error_message' => 'blahblah', + 'error_levels' => [], + 'strict_mode' => false, + 'php_version' => '7.3', ]; } }