Skip to content

Commit

Permalink
Also cover the 'yield from [];' statement
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jul 31, 2024
1 parent fa0e4f6 commit c23fadf
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions tests/unit/Framework/MockObject/ReturnValueGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,35 @@ public function test_Generates_callable_for_Closure(): void

public function test_Generates_Generator_for_Generator(): void
{
$this->assertInstanceOf(Generator::class, $this->generate('Generator'));
$value = $this->generate('Generator');

$this->assertInstanceOf(Generator::class, $value);

foreach ($value as $element) {
$this->assertSame([], $element);
}
}

public function test_Generates_Generator_for_Traversable(): void
{
$this->assertInstanceOf(Generator::class, $this->generate('Traversable'));
$value = $this->generate('Traversable');

$this->assertInstanceOf(Generator::class, $value);

foreach ($value as $element) {
$this->assertSame([], $element);
}
}

public function test_Generates_Generator_for_iterable(): void
{
$this->assertInstanceOf(Generator::class, $this->generate('iterable'));
$value = $this->generate('iterable');

$this->assertInstanceOf(Generator::class, $value);

foreach ($value as $element) {
$this->assertSame([], $element);
}
}

public function test_Generates_test_stub_for_class_or_interface_name(): void
Expand Down

0 comments on commit c23fadf

Please sign in to comment.