File tree Expand file tree Collapse file tree
Integration/Mapper/Strategy Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+ namespace ScriptFUSIONTest \Integration \Mapper \Strategy ;
3+
4+ use Mockery \Adapter \Phpunit \MockeryPHPUnitIntegration ;
5+ use Mockery \MockInterface ;
6+ use ScriptFUSION \Mapper \Mapper ;
7+ use ScriptFUSION \Mapper \Strategy \Either ;
8+ use ScriptFUSION \Mapper \Strategy \Strategy ;
9+
10+ final class EitherTest extends \PHPUnit_Framework_TestCase
11+ {
12+ use MockeryPHPUnitIntegration;
13+
14+ /** @var Either */
15+ private $ either ;
16+
17+ /** @var MockInterface */
18+ private $ strategy ;
19+
20+ protected function setUp ()
21+ {
22+ $ this ->either = (new Either ($ this ->strategy = \Mockery::spy (Strategy::class), 'bar ' ))->setMapper (new Mapper );
23+ }
24+
25+ public function testNonNullStrategy ()
26+ {
27+ $ either = $ this ->either ;
28+ $ this ->strategy ->shouldReceive ('__invoke ' )->andReturn ('foo ' );
29+
30+ self ::assertSame ('foo ' , $ either ([]));
31+ }
32+
33+ public function testNullStrategy ()
34+ {
35+ $ either = $ this ->either ;
36+
37+ self ::assertSame ('bar ' , $ either ([]));
38+ }
39+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ namespace ScriptFUSIONTest \Unit \Mapper \Strategy ;
3+
4+ use ScriptFUSION \Mapper \Strategy \Walk ;
5+ use ScriptFUSIONTest \MockFactory ;
6+
7+ final class WalkTest extends \PHPUnit_Framework_TestCase
8+ {
9+ public function test ()
10+ {
11+ /** @var Walk $walk */
12+ $ walk = (new Walk (null , 'foo->bar ' ))
13+ ->setMapper (MockFactory::mockMapper (['foo ' => ['bar ' => 'baz ' ]]))
14+ ;
15+
16+ self ::assertSame ('baz ' , $ walk ([]));
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments