Completed
Push — master ( cc06f9...4fbb13 )
by Aimeos
10:31
created
lib/custom/tests/MW/Session/FlowTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	protected function setUp()
27 27
 	{
28
-		if( class_exists( '\\TYPO3\\Flow\\Session\\Session' ) === false ) {
29
-			$this->markTestSkipped( 'Class \\TYPO3\\Flow\\Session\\Session not found' );
28
+		if (class_exists('\\TYPO3\\Flow\\Session\\Session') === false) {
29
+			$this->markTestSkipped('Class \\TYPO3\\Flow\\Session\\Session not found');
30 30
 		}
31 31
 
32 32
 		$session = new \TYPO3\Flow\Session\TransientSession();
33 33
 		$session->start();
34 34
 
35
-		$this->object = new \Aimeos\MW\Session\Flow( $session );
35
+		$this->object = new \Aimeos\MW\Session\Flow($session);
36 36
 	}
37 37
 
38 38
 
@@ -44,26 +44,26 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	protected function tearDown()
46 46
 	{
47
-		unset( $this->object );
47
+		unset($this->object);
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testGetDefault()
52 52
 	{
53
-		$this->assertEquals( null, $this->object->get( 'notexist' ) );
53
+		$this->assertEquals(null, $this->object->get('notexist'));
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testGetSet()
58 58
 	{
59
-		$this->object->set( 'key', 'value' );
60
-		$this->assertEquals( 'value', $this->object->get( 'key' ) );
59
+		$this->object->set('key', 'value');
60
+		$this->assertEquals('value', $this->object->get('key'));
61 61
 	}
62 62
 
63 63
 
64 64
 	public function testGetSetArray()
65 65
 	{
66
-		$this->object->set( 'key', array( 'value' ) );
67
-		$this->assertEquals( array( 'value' ), $this->object->get( 'key' ) );
66
+		$this->object->set('key', array('value'));
67
+		$this->assertEquals(array('value'), $this->object->get('key'));
68 68
 	}
69 69
 }
Please login to merge, or discard this patch.
lib/custom/tests/bootstrap.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@
 block discarded – undo
9 9
  * Set error reporting to maximum
10 10
  */
11 11
 error_reporting( -1 );
12
-ini_set( 'display_errors', '1' );
12
+ini_set('display_errors', '1');
13 13
 
14 14
 
15 15
 /*
16 16
  * Set locale settings to reasonable defaults
17 17
  */
18
-setlocale( LC_ALL, 'en_US.UTF-8' );
19
-setlocale( LC_CTYPE, 'en_US.UTF-8' );
20
-setlocale( LC_NUMERIC, 'POSIX' );
21
-setlocale( LC_TIME, 'POSIX' );
22
-date_default_timezone_set( 'UTC' );
18
+setlocale(LC_ALL, 'en_US.UTF-8');
19
+setlocale(LC_CTYPE, 'en_US.UTF-8');
20
+setlocale(LC_NUMERIC, 'POSIX');
21
+setlocale(LC_TIME, 'POSIX');
22
+date_default_timezone_set('UTC');
23 23
 
24 24
 require_once 'TestHelper.php';
25 25
 TestHelper::bootstrap();
Please login to merge, or discard this patch.
lib/custom/src/MW/Logger/Flow.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param \TYPO3\Flow\Log\SystemLoggerInterface $logger Flow logger object
31 31
 	 */
32
-	public function __construct( \TYPO3\Flow\Log\SystemLoggerInterface $logger )
32
+	public function __construct(\TYPO3\Flow\Log\SystemLoggerInterface $logger)
33 33
 	{
34 34
 		$this->logger = $logger;
35 35
 	}
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
 	 * @throws \Aimeos\MW\Logger\Exception If an error occurs in Zend_Log
45 45
 	 * @see \Aimeos\MW\Logger\Base for available log level constants
46 46
 	 */
47
-	public function log( $message, $priority = \Aimeos\MW\Logger\Base::ERR, $facility = 'message' )
47
+	public function log($message, $priority = \Aimeos\MW\Logger\Base::ERR, $facility = 'message')
48 48
 	{
49 49
 		try
50 50
 		{
51
-			if( !is_scalar( $message ) ) {
52
-				$message = json_encode( $message );
51
+			if (!is_scalar($message)) {
52
+				$message = json_encode($message);
53 53
 			}
54 54
 
55
-			$this->logger->log( $message, $this->translatePriority( $priority ) );
55
+			$this->logger->log($message, $this->translatePriority($priority));
56 56
 		}
57
-		catch( \Exception $e )	{
58
-			throw new \Aimeos\MW\Logger\Exception( $e->getMessage(), $e->getCode(), $e );
57
+		catch (\Exception $e) {
58
+			throw new \Aimeos\MW\Logger\Exception($e->getMessage(), $e->getCode(), $e);
59 59
 		}
60 60
 	}
61 61
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 * @return integer Log level from Monolog\Logger
68 68
 	 * @throws \Aimeos\MW\Logger\Exception If log level is unknown
69 69
 	 */
70
-	protected function translatePriority( $priority )
70
+	protected function translatePriority($priority)
71 71
 	{
72
-		switch( $priority )
72
+		switch ($priority)
73 73
 		{
74 74
 			case \Aimeos\MW\Logger\Base::EMERG:
75 75
 				return LOG_EMERG;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			case \Aimeos\MW\Logger\Base::DEBUG:
89 89
 				return LOG_DEBUG;
90 90
 			default:
91
-				throw new \Aimeos\MW\Logger\Exception( 'Invalid log level' );
91
+				throw new \Aimeos\MW\Logger\Exception('Invalid log level');
92 92
 		}
93 93
 	}
94 94
 }
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@
 block discarded – undo
53 53
 			}
54 54
 
55 55
 			$this->logger->log( $message, $this->translatePriority( $priority ) );
56
-		}
57
-		catch( \Exception $e )	{
56
+		} catch( \Exception $e )	{
58 57
 			throw new \Aimeos\MW\Logger\Exception( $e->getMessage(), $e->getCode(), $e );
59 58
 		}
60 59
 	}
Please login to merge, or discard this patch.
lib/custom/src/MW/Session/Flow.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param \TYPO3\Flow\Session\SessionInterface $object Flow session object
30 30
 	 */
31
-	public function __construct( \TYPO3\Flow\Session\SessionInterface $object )
31
+	public function __construct(\TYPO3\Flow\Session\SessionInterface $object)
32 32
 	{
33 33
 		$this->object = $object;
34 34
 	}
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
 	 * @param mixed $default Value returned if requested key isn't found
44 44
 	 * @return mixed Value associated to the requested key
45 45
 	 */
46
-	public function get( $name, $default = null )
46
+	public function get($name, $default = null)
47 47
 	{
48
-		if( $this->object->hasKey( $name ) !== true ) {
48
+		if ($this->object->hasKey($name) !== true) {
49 49
 			return $default;
50 50
 		}
51 51
 
52
-		return $this->object->getData( $name );
52
+		return $this->object->getData($name);
53 53
 	}
54 54
 
55 55
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 * @param mixed $value Value that should be associated with the given key
63 63
 	 * @return void
64 64
 	 */
65
-	public function set( $name, $value )
65
+	public function set($name, $value)
66 66
 	{
67
-		$this->object->putData( $name, $value );
67
+		$this->object->putData($name, $value);
68 68
 	}
69 69
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/Logger/FlowTest.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	protected function setUp()
27 27
 	{
28
-		if( class_exists( '\\TYPO3\\Flow\\Log\\Logger' ) === false ) {
29
-			$this->markTestSkipped( 'Class \\TYPO3\\Flow\\Log\\Logger not found' );
28
+		if (class_exists('\\TYPO3\\Flow\\Log\\Logger') === false) {
29
+			$this->markTestSkipped('Class \\TYPO3\\Flow\\Log\\Logger not found');
30 30
 		}
31 31
 
32 32
 		$be = new \TYPO3\Flow\Log\Backend\FileBackend();
33
-		$be->setSeverityThreshold( LOG_ERR );
34
-		$be->setLogFileURL( 'flow.log' );
33
+		$be->setSeverityThreshold(LOG_ERR);
34
+		$be->setLogFileURL('flow.log');
35 35
 
36 36
 		$log = new \TYPO3\Flow\Log\Logger();
37
-		$log->addBackend( $be );
37
+		$log->addBackend($be);
38 38
 
39
-		$this->object = new \Aimeos\MW\Logger\Flow( $log );
39
+		$this->object = new \Aimeos\MW\Logger\Flow($log);
40 40
 	}
41 41
 
42 42
 
@@ -48,53 +48,53 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	protected function tearDown()
50 50
 	{
51
-		@unlink( 'flow.log' );
51
+		@unlink('flow.log');
52 52
 	}
53 53
 
54 54
 
55 55
 	public function testLog()
56 56
 	{
57
-		$this->object->log( 'error' );
58
-		$this->assertRegExp( '/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+error/', file_get_contents( 'flow.log' ) );
57
+		$this->object->log('error');
58
+		$this->assertRegExp('/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+error/', file_get_contents('flow.log'));
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testNonScalarLog()
63 63
 	{
64
-		$this->object->log( array( 'error', 'error2', 2 ) );
65
-		$this->assertRegExp( '/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+\["error","error2",2\]/', file_get_contents( 'flow.log' ) );
64
+		$this->object->log(array('error', 'error2', 2));
65
+		$this->assertRegExp('/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+\["error","error2",2\]/', file_get_contents('flow.log'));
66 66
 	}
67 67
 
68 68
 
69 69
 	public function testLogDebug()
70 70
 	{
71
-		$this->object->log( 'debug', \Aimeos\MW\Logger\Base::DEBUG );
72
-		$this->assertEquals( '', file_get_contents( 'flow.log' ) );
71
+		$this->object->log('debug', \Aimeos\MW\Logger\Base::DEBUG);
72
+		$this->assertEquals('', file_get_contents('flow.log'));
73 73
 	}
74 74
 
75 75
 
76 76
 	public function testBadPriority()
77 77
 	{
78
-		$this->setExpectedException( '\\Aimeos\\MW\\Logger\\Exception' );
79
-		$this->object->log( 'error', -1 );
78
+		$this->setExpectedException('\\Aimeos\\MW\\Logger\\Exception');
79
+		$this->object->log('error', -1);
80 80
 	}
81 81
 
82 82
 
83 83
 	public function testLogPriorityTranslate()
84 84
 	{
85
-		$this->object->log( '', \Aimeos\MW\Logger\Base::EMERG );
86
-		$this->object->log( '', \Aimeos\MW\Logger\Base::ALERT );
87
-		$this->object->log( '', \Aimeos\MW\Logger\Base::CRIT );
88
-		$this->object->log( '', \Aimeos\MW\Logger\Base::ERR );
89
-		$this->object->log( '', \Aimeos\MW\Logger\Base::WARN );
90
-		$this->object->log( '', \Aimeos\MW\Logger\Base::NOTICE );
91
-		$this->object->log( '', \Aimeos\MW\Logger\Base::INFO );
92
-		$this->object->log( '', \Aimeos\MW\Logger\Base::DEBUG );
93
-
94
-		$content = file_get_contents( 'flow.log' );
95
-		$this->assertContains( 'EMERGENCY', $content );
96
-		$this->assertContains( 'ALERT', $content );
97
-		$this->assertContains( 'CRITICAL', $content );
98
-		$this->assertContains( 'ERROR', $content );
85
+		$this->object->log('', \Aimeos\MW\Logger\Base::EMERG);
86
+		$this->object->log('', \Aimeos\MW\Logger\Base::ALERT);
87
+		$this->object->log('', \Aimeos\MW\Logger\Base::CRIT);
88
+		$this->object->log('', \Aimeos\MW\Logger\Base::ERR);
89
+		$this->object->log('', \Aimeos\MW\Logger\Base::WARN);
90
+		$this->object->log('', \Aimeos\MW\Logger\Base::NOTICE);
91
+		$this->object->log('', \Aimeos\MW\Logger\Base::INFO);
92
+		$this->object->log('', \Aimeos\MW\Logger\Base::DEBUG);
93
+
94
+		$content = file_get_contents('flow.log');
95
+		$this->assertContains('EMERGENCY', $content);
96
+		$this->assertContains('ALERT', $content);
97
+		$this->assertContains('CRITICAL', $content);
98
+		$this->assertContains('ERROR', $content);
99 99
 	}
100 100
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Request/FlowTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,41 +14,41 @@
 block discarded – undo
14 14
 
15 15
 	protected function setUp()
16 16
 	{
17
-		if( !class_exists( '\TYPO3\Flow\Http\Request' ) ) {
18
-			$this->markTestSkipped( '\TYPO3\Flow\Http\Request is not available' );
17
+		if (!class_exists('\TYPO3\Flow\Http\Request')) {
18
+			$this->markTestSkipped('\TYPO3\Flow\Http\Request is not available');
19 19
 		}
20 20
 
21
-		if( !class_exists( '\Zend\Diactoros\ServerRequestFactory' ) ) {
22
-			$this->markTestSkipped( '\Zend\Diactoros\ServerRequestFactory is not available' );
21
+		if (!class_exists('\Zend\Diactoros\ServerRequestFactory')) {
22
+			$this->markTestSkipped('\Zend\Diactoros\ServerRequestFactory is not available');
23 23
 		}
24 24
 
25 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 );
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 29
 	}
30 30
 
31 31
 
32 32
 	protected function tearDown()
33 33
 	{
34
-		unset( $this->object, $this->mock );
34
+		unset($this->object, $this->mock);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testTransform()
39 39
 	{
40
-		$this->assertInstanceOf( '\Aimeos\MW\View\Helper\Request\Flow', $this->object->transform() );
40
+		$this->assertInstanceOf('\Aimeos\MW\View\Helper\Request\Flow', $this->object->transform());
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testGetClientAddress()
45 45
 	{
46
-		$this->assertEquals( '127.0.0.1', $this->object->getClientAddress() );
46
+		$this->assertEquals('127.0.0.1', $this->object->getClientAddress());
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testGetTarget()
51 51
 	{
52
-		$this->assertEquals( null, $this->object->getTarget() );
52
+		$this->assertEquals(null, $this->object->getTarget());
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Response/FlowTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		if( !class_exists( '\Zend\Diactoros\Response' ) ) {
20
-			$this->markTestSkipped( '\Zend\Diactoros\Response is not available' );
19
+		if (!class_exists('\Zend\Diactoros\Response')) {
20
+			$this->markTestSkipped('\Zend\Diactoros\Response is not available');
21 21
 		}
22 22
 
23 23
 		$view = new \Aimeos\MW\View\Standard();
24
-		$this->object = new \Aimeos\MW\View\Helper\Response\Flow( $view );
24
+		$this->object = new \Aimeos\MW\View\Helper\Response\Flow($view);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		unset( $this->object );
30
+		unset($this->object);
31 31
 	}
32 32
 
33 33
 
34 34
 	public function testTransform()
35 35
 	{
36
-		$this->assertInstanceOf( '\Aimeos\MW\View\Helper\Response\Flow', $this->object->transform() );
36
+		$this->assertInstanceOf('\Aimeos\MW\View\Helper\Response\Flow', $this->object->transform());
37 37
 	}
38 38
 }
Please login to merge, or discard this patch.
lib/custom/src/MW/View/Helper/Request/Flow.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	 * @param array $cookies List of uploaded files like in $_COOKIES
40 40
 	 * @param array $server List of uploaded files like in $_SERVER
41 41
 	 */
42
-	public function __construct( \Aimeos\MW\View\Iface $view, \TYPO3\Flow\Http\Request $request, array $files = array(),
43
-		array $query = array(), array $post = array(), array $cookies = array(), array $server = array() )
42
+	public function __construct(\Aimeos\MW\View\Iface $view, \TYPO3\Flow\Http\Request $request, array $files = array(),
43
+		array $query = array(), array $post = array(), array $cookies = array(), array $server = array())
44 44
 	{
45 45
 		$this->request = $request;
46
-		$psr7request = $this->createRequest( $request, $files, $query, $post, $cookies, $server );
46
+		$psr7request = $this->createRequest($request, $files, $query, $post, $cookies, $server);
47 47
 
48
-		parent::__construct( $view, $psr7request );
48
+		parent::__construct($view, $psr7request);
49 49
 	}
50 50
 
51 51
 
@@ -82,18 +82,18 @@  discard block
 block discarded – undo
82 82
 	 * @param array $server List of uploaded files like in $_SERVER
83 83
 	 * @return \Psr\Http\Message\ServerRequestInterface PSR-7 request object
84 84
 	 */
85
-	protected function createRequest( \TYPO3\Flow\Http\Request $nativeRequest, array $files,
86
-		array $query, array $post, array $cookies, array $server )
85
+	protected function createRequest(\TYPO3\Flow\Http\Request $nativeRequest, array $files,
86
+		array $query, array $post, array $cookies, array $server)
87 87
 	{
88
-		$server = ServerRequestFactory::normalizeServer( $server );
89
-		$files = ServerRequestFactory::normalizeFiles( $files );
88
+		$server = ServerRequestFactory::normalizeServer($server);
89
+		$files = ServerRequestFactory::normalizeFiles($files);
90 90
 		$headers = $nativeRequest->getHeaders()->getAll();
91 91
 		$uri = (string) $nativeRequest->getUri();
92 92
 		$method = $nativeRequest->getMethod();
93 93
 
94 94
 		$body = new Stream('php://temp', 'wb+');
95
-		$body->write( $nativeRequest->getContent() );
95
+		$body->write($nativeRequest->getContent());
96 96
 
97
-		return new ServerRequest( $server, $files, $uri, $method, $body, $headers, $cookies, $query, $post );
97
+		return new ServerRequest($server, $files, $uri, $method, $body, $headers, $cookies, $query, $post);
98 98
 	}
99 99
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	/**
32 32
 	 * Initializes the request view helper.
33 33
 	 *
34
-	 * @param \\Aimeos\MW\View\Iface $view View instance with registered view helpers
34
+	 * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers
35 35
 	 * @param \TYPO3\Flow\Http\Request $request Flow request object
36 36
 	 * @param array $files List of uploaded files like in $_FILES
37 37
 	 * @param array $query List of uploaded files like in $_GET
Please login to merge, or discard this patch.
lib/custom/src/MW/View/Helper/Response/Flow.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
 	 *
27 27
 	 * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers
28 28
 	 */
29
-	public function __construct( \Aimeos\MW\View\Iface $view )
29
+	public function __construct(\Aimeos\MW\View\Iface $view)
30 30
 	{
31
-		parent::__construct( $view, new \Zend\Diactoros\Response() );
31
+		parent::__construct($view, new \Zend\Diactoros\Response());
32 32
 	}
33 33
 }
Please login to merge, or discard this patch.