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