Completed
Push — master ( 99dfa7...cc4116 )
by Aimeos
12:53
created

FlowTest::testGetUploadedFiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
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
9
 */
10
class FlowTest extends \PHPUnit_Framework_TestCase
11
{
12
	private $object;
13
	private $mock;
14
15
16
	/**
17
	 * Sets up the fixture, for example, opens a network connection.
18
	 * This method is called before a test is executed.
19
	 *
20
	 * @access protected
21
	 */
22
	protected function setUp()
23
	{
24
		if( !class_exists( '\TYPO3\Flow\Http\Request' ) ) {
25
			$this->markTestSkipped( '\TYPO3\Flow\Http\Request is not available' );
26
		}
27
28
		$this->mock = $this->getMockBuilder( '\TYPO3\Flow\Http\Request' )
29
			->setConstructorArgs( array( array(), array(), array(), array() ) )->getMock();
30
31
		$view = new \Aimeos\MW\View\Standard();
32
		$this->object = new \Aimeos\MW\View\Helper\Request\Flow( $view, $this->mock, array() );
33
	}
34
35
36
	/**
37
	 * Tears down the fixture, for example, closes a network connection.
38
	 * This method is called after a test is executed.
39
	 *
40
	 * @access protected
41
	 */
42
	protected function tearDown()
43
	{
44
		unset( $this->object, $this->mock );
45
	}
46
47
48
	public function testTransform()
49
	{
50
		$this->assertInstanceOf( '\\Aimeos\\MW\\View\\Helper\\Request\\Flow', $this->object->transform() );
51
	}
52
53
54 View Code Duplication
	public function testGetBody()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
	{
56
		$this->mock->expects( $this->once() )->method( 'getContent' )
57
			->will( $this->returnValue( 'body' ) );
58
59
		$this->assertEquals( 'body', $this->object->transform()->getBody() );
60
	}
61
62
63 View Code Duplication
	public function testGetClientAddress()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
64
	{
65
		$this->mock->expects( $this->once() )->method( 'getClientIpAddress' )
66
			->will( $this->returnValue( '127.0.0.1' ) );
67
68
		$this->assertEquals( '127.0.0.1', $this->object->transform()->getClientAddress() );
69
	}
70
71
72
	public function testGetTarget()
73
	{
74
		$this->assertEquals( null, $this->object->transform()->getTarget() );
75
	}
76
77
78
	public function testGetUploadedFiles()
79
	{
80
		$files = $this->object->transform()->getUploadedFiles();
81
82
		$this->assertEquals( array(), $files );
83
	}
84
}
85