| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Aimeos\MW\View\Helper\Request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @copyright Aimeos (aimeos.org), 2015-2016 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | class FlowTest extends \PHPUnit_Framework_TestCase | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | 	private $object; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 	protected function setUp() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | 		if( !class_exists( '\TYPO3\Flow\Http\Request' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 			$this->markTestSkipped( '\TYPO3\Flow\Http\Request is not available' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 		if( !class_exists( '\Zend\Diactoros\ServerRequestFactory' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 			$this->markTestSkipped( '\Zend\Diactoros\ServerRequestFactory is not available' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 		$view = new \Aimeos\MW\View\Standard(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 		$server = array( 'REMOTE_ADDR' => '127.0.0.1' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 		$request = new \TYPO3\Flow\Http\Request( array(), array(), array(), $server ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 		$this->object = new \Aimeos\MW\View\Helper\Request\Flow( $view, $request, array(), array(), array(), array(), $server ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	protected function tearDown() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 		unset( $this->object, $this->mock ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	public function testTransform() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 		$this->assertInstanceOf( '\Aimeos\MW\View\Helper\Request\Flow', $this->object->transform() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 	public function testGetClientAddress() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 		$this->assertEquals( '127.0.0.1', $this->object->getClientAddress() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 	public function testGetTarget() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 		$this->assertEquals( null, $this->object->getTarget() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  |