Skip to content

Commit c23fadf

Browse files
Also cover the 'yield from [];' statement
1 parent fa0e4f6 commit c23fadf

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

tests/unit/Framework/MockObject/ReturnValueGeneratorTest.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,35 @@ public function test_Generates_callable_for_Closure(): void
120120

121121
public function test_Generates_Generator_for_Generator(): void
122122
{
123-
$this->assertInstanceOf(Generator::class, $this->generate('Generator'));
123+
$value = $this->generate('Generator');
124+
125+
$this->assertInstanceOf(Generator::class, $value);
126+
127+
foreach ($value as $element) {
128+
$this->assertSame([], $element);
129+
}
124130
}
125131

126132
public function test_Generates_Generator_for_Traversable(): void
127133
{
128-
$this->assertInstanceOf(Generator::class, $this->generate('Traversable'));
134+
$value = $this->generate('Traversable');
135+
136+
$this->assertInstanceOf(Generator::class, $value);
137+
138+
foreach ($value as $element) {
139+
$this->assertSame([], $element);
140+
}
129141
}
130142

131143
public function test_Generates_Generator_for_iterable(): void
132144
{
133-
$this->assertInstanceOf(Generator::class, $this->generate('iterable'));
145+
$value = $this->generate('iterable');
146+
147+
$this->assertInstanceOf(Generator::class, $value);
148+
149+
foreach ($value as $element) {
150+
$this->assertSame([], $element);
151+
}
134152
}
135153

136154
public function test_Generates_test_stub_for_class_or_interface_name(): void

0 commit comments

Comments
 (0)