File tree 1 file changed +14
-4
lines changed
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -80,11 +80,14 @@ public function testMockingClassWithNewInInitializer()
80
80
/** @test */
81
81
public function it_can_mock_a_class_with_an_intersection_argument_type_hint ()
82
82
{
83
- $ mock = Mockery::mock (ArgumentIntersectionTypeHint::class);
83
+ $ mock = Mockery::spy (ArgumentIntersectionTypeHint::class);
84
84
$ object = new IntersectionTypeHelperClass ();
85
85
$ mock ->allows ()->foo ($ object );
86
86
87
87
$ mock ->foo ($ object );
88
+
89
+ $ this ->expectException (\TypeError::class);
90
+ $ mock ->foo (Mockery::mock (IntersectionTypeHelper1Interface::class));
88
91
}
89
92
90
93
/** @test */
@@ -184,16 +187,23 @@ public function exits(): never
184
187
exit (123 );
185
188
}
186
189
}
187
- class IntersectionTypeHelperClass
190
+ class IntersectionTypeHelperClass implements IntersectionTypeHelper1Interface, IntersectionTypeHelper2Interface
191
+ {
192
+ function foo (): int { return 123 ; }
193
+ function bar (): int { return 123 ; }
194
+ }
195
+ interface IntersectionTypeHelper2Interface
188
196
{
197
+ function foo (): int ;
189
198
}
190
- interface IntersectionTypeHelperInterface
199
+ interface IntersectionTypeHelper1Interface
191
200
{
201
+ function bar (): int ;
192
202
}
193
203
194
204
class ArgumentIntersectionTypeHint
195
205
{
196
- public function foo (IntersectionTypeHelperClass & IntersectionTypeHelperInterface $ foo )
206
+ public function foo (IntersectionTypeHelper1Interface & IntersectionTypeHelper2Interface $ foo )
197
207
{
198
208
}
199
209
}
You can’t perform that action at this time.
0 commit comments