@@ 50-64 (lines=15) @@ | ||
47 | * @test |
|
48 | * @dataProvider dataProviderShouldAskInnerFactoryIfUnderstandsString |
|
49 | */ |
|
50 | public function shouldAskInnerFactoryIfUnderstandsString(bool $expectedResult, string $source) |
|
51 | { |
|
52 | $this->container->expects($this->once())->method('get')->with( |
|
53 | $this->equalTo('some-service-id') |
|
54 | )->willReturn($this->loadedArgumentFactory); |
|
55 | ||
56 | $this->loadedArgumentFactory->expects($this->once())->method('understandsString')->with( |
|
57 | $this->equalTo($source) |
|
58 | )->willReturn($expectedResult); |
|
59 | ||
60 | /** @var bool $actualResult */ |
|
61 | $actualResult = $this->factory->understandsString($source); |
|
62 | ||
63 | $this->assertEquals($expectedResult, $actualResult); |
|
64 | } |
|
65 | ||
66 | public function dataProviderShouldAskInnerFactoryIfUnderstandsString() |
|
67 | { |
|
@@ 78-92 (lines=15) @@ | ||
75 | * @test |
|
76 | * @dataProvider dataProviderShouldAskInnerFactoryIfUnderstandsArray |
|
77 | */ |
|
78 | public function shouldAskInnerFactoryIfUnderstandsArray(bool $expectedResult, array $source) |
|
79 | { |
|
80 | $this->container->expects($this->once())->method('get')->with( |
|
81 | $this->equalTo('some-service-id') |
|
82 | )->willReturn($this->loadedArgumentFactory); |
|
83 | ||
84 | $this->loadedArgumentFactory->expects($this->once())->method('understandsArray')->with( |
|
85 | $this->equalTo($source) |
|
86 | )->willReturn($expectedResult); |
|
87 | ||
88 | /** @var bool $actualResult */ |
|
89 | $actualResult = $this->factory->understandsArray($source); |
|
90 | ||
91 | $this->assertEquals($expectedResult, $actualResult); |
|
92 | } |
|
93 | ||
94 | public function dataProviderShouldAskInnerFactoryIfUnderstandsArray() |
|
95 | { |
|
@@ 106-120 (lines=15) @@ | ||
103 | * @test |
|
104 | * @dataProvider dataProviderShouldCreateArgumentFromStringUsingInnerFactory |
|
105 | */ |
|
106 | public function shouldCreateArgumentFromStringUsingInnerFactory(Argument $expectedResult, string $source) |
|
107 | { |
|
108 | $this->container->expects($this->once())->method('get')->with( |
|
109 | $this->equalTo('some-service-id') |
|
110 | )->willReturn($this->loadedArgumentFactory); |
|
111 | ||
112 | $this->loadedArgumentFactory->expects($this->once())->method('createArgumentFromString')->with( |
|
113 | $this->equalTo($source) |
|
114 | )->willReturn($expectedResult); |
|
115 | ||
116 | /** @var mixed $actualResult */ |
|
117 | $actualResult = $this->factory->createArgumentFromString($source); |
|
118 | ||
119 | $this->assertEquals($expectedResult, $actualResult); |
|
120 | } |
|
121 | ||
122 | public function dataProviderShouldCreateArgumentFromStringUsingInnerFactory() |
|
123 | { |
|
@@ 134-148 (lines=15) @@ | ||
131 | * @test |
|
132 | * @dataProvider dataProviderShouldCreateArgumentFromArrayUsingInnerFactory |
|
133 | */ |
|
134 | public function shouldCreateArgumentFromArrayUsingInnerFactory(Argument $expectedResult, array $source) |
|
135 | { |
|
136 | $this->container->expects($this->once())->method('get')->with( |
|
137 | $this->equalTo('some-service-id') |
|
138 | )->willReturn($this->loadedArgumentFactory); |
|
139 | ||
140 | $this->loadedArgumentFactory->expects($this->once())->method('createArgumentFromArray')->with( |
|
141 | $this->equalTo($source) |
|
142 | )->willReturn($expectedResult); |
|
143 | ||
144 | /** @var mixed $actualResult */ |
|
145 | $actualResult = $this->factory->createArgumentFromArray($source); |
|
146 | ||
147 | $this->assertEquals($expectedResult, $actualResult); |
|
148 | } |
|
149 | ||
150 | public function dataProviderShouldCreateArgumentFromArrayUsingInnerFactory() |
|
151 | { |