| @@ 13-43 (lines=31) @@ | ||
| 10 | * @copyright Copyright 2015 Fwolf |
|
| 11 | * @license http://www.gnu.org/licenses/lgpl.html LGPL-3.0+ |
|
| 12 | */ |
|
| 13 | class HtmlHelperAwareTraitTest extends PHPUnitTestCase |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * @return MockObject | HtmlHelperAwareTrait |
|
| 17 | */ |
|
| 18 | protected function buildMock() |
|
| 19 | { |
|
| 20 | $mock = $this->getMockBuilder(HtmlHelperAwareTrait::class) |
|
| 21 | ->getMockForTrait(); |
|
| 22 | ||
| 23 | return $mock; |
|
| 24 | } |
|
| 25 | ||
| 26 | ||
| 27 | public function testSetGetHtmlHelper() |
|
| 28 | { |
|
| 29 | $htmlHelperAware = $this->buildMock(); |
|
| 30 | ||
| 31 | $htmlHelper = $this->reflectionCall($htmlHelperAware, 'getHtmlHelper'); |
|
| 32 | $this->assertInstanceOf(HtmlHelper::class, $htmlHelper); |
|
| 33 | $this->assertNull( |
|
| 34 | $this->reflectionGet($htmlHelperAware, 'htmlHelper') |
|
| 35 | ); |
|
| 36 | ||
| 37 | $htmlHelperAware->setHtmlHelper($htmlHelper); |
|
| 38 | $this->assertInstanceOf(HtmlHelper::class, $htmlHelper); |
|
| 39 | $this->assertNotNull( |
|
| 40 | $this->reflectionGet($htmlHelperAware, 'htmlHelper') |
|
| 41 | ); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||
| @@ 13-39 (lines=27) @@ | ||
| 10 | * @copyright Copyright 2015 Fwolf |
|
| 11 | * @license http://www.gnu.org/licenses/lgpl.html LGPL-3.0+ |
|
| 12 | */ |
|
| 13 | class RequestAwareTraitTest extends PHPUnitTestCase |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * @return MockObject | RequestAwareTrait |
|
| 17 | */ |
|
| 18 | protected function buildMock() |
|
| 19 | { |
|
| 20 | $mock = $this->getMockBuilder(RequestAwareTrait::class) |
|
| 21 | ->getMockForTrait(); |
|
| 22 | ||
| 23 | return $mock; |
|
| 24 | } |
|
| 25 | ||
| 26 | ||
| 27 | public function testSetGetRequest() |
|
| 28 | { |
|
| 29 | $requestAware = $this->buildMock(); |
|
| 30 | ||
| 31 | $request = $this->reflectionCall($requestAware, 'getRequest'); |
|
| 32 | $this->assertInstanceOf(RequestInterface::class, $request); |
|
| 33 | $this->assertNull($this->reflectionGet($requestAware, 'request')); |
|
| 34 | ||
| 35 | $requestAware->setRequest($request); |
|
| 36 | $this->assertInstanceOf(RequestInterface::class, $request); |
|
| 37 | $this->assertNotNull($this->reflectionGet($requestAware, 'request')); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| @@ 13-39 (lines=27) @@ | ||
| 10 | * @copyright Copyright 2015 Fwolf |
|
| 11 | * @license http://www.gnu.org/licenses/lgpl.html LGPL-3.0+ |
|
| 12 | */ |
|
| 13 | class ResponseAwareTraitTest extends PHPUnitTestCase |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * @return MockObject | ResponseAwareTrait |
|
| 17 | */ |
|
| 18 | protected function buildMock() |
|
| 19 | { |
|
| 20 | $mock = $this->getMockBuilder(ResponseAwareTrait::class) |
|
| 21 | ->getMockForTrait(); |
|
| 22 | ||
| 23 | return $mock; |
|
| 24 | } |
|
| 25 | ||
| 26 | ||
| 27 | public function testSetGetResponse() |
|
| 28 | { |
|
| 29 | $responseAware = $this->buildMock(); |
|
| 30 | ||
| 31 | $response = $this->reflectionCall($responseAware, 'getResponse'); |
|
| 32 | $this->assertInstanceOf(ResponseInterface::class, $response); |
|
| 33 | $this->assertNull($this->reflectionGet($responseAware, 'response')); |
|
| 34 | ||
| 35 | $responseAware->setResponse($response); |
|
| 36 | $this->assertInstanceOf(ResponseInterface::class, $response); |
|
| 37 | $this->assertNotNull($this->reflectionGet($responseAware, 'response')); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||