|
@@ 47-64 (lines=18) @@
|
| 44 |
|
$flow->flow($file); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testFlow() |
| 48 |
|
{ |
| 49 |
|
$eachFlow = m::mock(FlowInterface::class); |
| 50 |
|
$flow = new Each($eachFlow); |
| 51 |
|
|
| 52 |
|
$node = m::mock(NodeInterface::class); |
| 53 |
|
$collection = new NodeCollection([$node]); |
| 54 |
|
|
| 55 |
|
$eachFlow->shouldReceive('flow') |
| 56 |
|
->with($node) |
| 57 |
|
->andReturn($node); |
| 58 |
|
|
| 59 |
|
$response = $flow->flow($collection); |
| 60 |
|
|
| 61 |
|
static::assertNotSame($response, $collection); |
| 62 |
|
static::assertEquals($collection->getAll(), $response->getAll()); |
| 63 |
|
static::assertInstanceOf(NodeCollectionInterface::class, $response); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public function testStaticFlow() |
| 67 |
|
{ |
|
@@ 66-83 (lines=18) @@
|
| 63 |
|
static::assertInstanceOf(NodeCollectionInterface::class, $response); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public function testStaticFlow() |
| 67 |
|
{ |
| 68 |
|
$eachFlow = m::mock(FlowInterface::class); |
| 69 |
|
$flow = Flow::each($eachFlow); |
| 70 |
|
|
| 71 |
|
$node = m::mock(NodeInterface::class); |
| 72 |
|
$collection = new NodeCollection([$node]); |
| 73 |
|
|
| 74 |
|
$eachFlow->shouldReceive('flow') |
| 75 |
|
->with($node) |
| 76 |
|
->andReturn($node); |
| 77 |
|
|
| 78 |
|
$response = $flow->flow($collection); |
| 79 |
|
|
| 80 |
|
static::assertNotSame($response, $collection); |
| 81 |
|
static::assertEquals($collection->getAll(), $response->getAll()); |
| 82 |
|
static::assertInstanceOf(NodeCollectionInterface::class, $response); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
public function testInvokeFlow() |
| 86 |
|
{ |
|
@@ 85-102 (lines=18) @@
|
| 82 |
|
static::assertInstanceOf(NodeCollectionInterface::class, $response); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
public function testInvokeFlow() |
| 86 |
|
{ |
| 87 |
|
$eachFlow = m::mock(FlowInterface::class); |
| 88 |
|
$flow = new Each($eachFlow); |
| 89 |
|
|
| 90 |
|
$node = m::mock(NodeInterface::class); |
| 91 |
|
$collection = new NodeCollection([$node]); |
| 92 |
|
|
| 93 |
|
$eachFlow->shouldReceive('flow') |
| 94 |
|
->with($node) |
| 95 |
|
->andReturn($node); |
| 96 |
|
|
| 97 |
|
$response = call_user_func($flow, $collection); |
| 98 |
|
|
| 99 |
|
static::assertNotSame($response, $collection); |
| 100 |
|
static::assertEquals($collection->getAll(), $response->getAll()); |
| 101 |
|
static::assertInstanceOf(NodeCollectionInterface::class, $response); |
| 102 |
|
} |
| 103 |
|
} |
| 104 |
|
|