Completed
Push — master ( 25c6af...9f51fe )
by Aimeos
02:20
created
controller/frontend/tests/Controller/Frontend/ExceptionTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 	protected function setUp()
17 17
 	{
18
-		$this->object = new \Aimeos\Controller\Frontend\Exception( 'msg', 1, null, array( 'key' => 'value' ) );
18
+		$this->object = new \Aimeos\Controller\Frontend\Exception('msg', 1, null, array('key' => 'value'));
19 19
 	}
20 20
 
21 21
 
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function testGetMessage()
28 28
 	{
29
-		$this->assertEquals( 'msg', $this->object->getMessage() );
29
+		$this->assertEquals('msg', $this->object->getMessage());
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testGetCode()
34 34
 	{
35
-		$this->assertEquals( 1, $this->object->getCode() );
35
+		$this->assertEquals(1, $this->object->getCode());
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testGetErrorList()
40 40
 	{
41
-		$this->assertEquals( array( 'key' => 'value' ), $this->object->getErrorList() );
41
+		$this->assertEquals(array('key' => 'value'), $this->object->getErrorList());
42 42
 	}
43 43
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
 	{
15 15
 		$target = '\\Aimeos\\Controller\\Frontend\\Basket\\Iface';
16 16
 
17
-		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext() );
18
-		$this->assertInstanceOf( $target, $controller );
17
+		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext());
18
+		$this->assertInstanceOf($target, $controller);
19 19
 
20
-		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
21
-		$this->assertInstanceOf( $target, $controller );
20
+		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
21
+		$this->assertInstanceOf($target, $controller);
22 22
 	}
23 23
 
24 24
 
25 25
 	public function testCreateControllerInvalidImplementation()
26 26
 	{
27
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
28
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
27
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
28
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCreateControllerInvalidName()
33 33
 	{
34
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
35
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), '%^');
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testCreateControllerNotExisting()
40 40
 	{
41
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Catalog/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
 	{
15 15
 		$target = '\\Aimeos\\Controller\\Frontend\\Catalog\\Iface';
16 16
 
17
-		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext() );
18
-		$this->assertInstanceOf( $target, $controller );
17
+		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext());
18
+		$this->assertInstanceOf($target, $controller);
19 19
 
20
-		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
21
-		$this->assertInstanceOf( $target, $controller );
20
+		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
21
+		$this->assertInstanceOf($target, $controller);
22 22
 	}
23 23
 
24 24
 
25 25
 	public function testCreateControllerInvalidImplementation()
26 26
 	{
27
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
28
-		\Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
27
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
28
+		\Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCreateControllerInvalidName()
33 33
 	{
34
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
35
+		\Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), '%^');
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testCreateControllerNotExisting()
40 40
 	{
41
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Order/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
 	{
15 15
 		$target = '\\Aimeos\\Controller\\Frontend\\Order\\Iface';
16 16
 
17
-		$controller = \Aimeos\Controller\Frontend\Order\Factory::createController( \TestHelperFrontend::getContext() );
18
-		$this->assertInstanceOf( $target, $controller );
17
+		$controller = \Aimeos\Controller\Frontend\Order\Factory::createController(\TestHelperFrontend::getContext());
18
+		$this->assertInstanceOf($target, $controller);
19 19
 
20
-		$controller = \Aimeos\Controller\Frontend\Order\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
21
-		$this->assertInstanceOf( $target, $controller );
20
+		$controller = \Aimeos\Controller\Frontend\Order\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
21
+		$this->assertInstanceOf($target, $controller);
22 22
 	}
23 23
 
24 24
 
25 25
 	public function testCreateControllerInvalidImplementation()
26 26
 	{
27
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
28
-		\Aimeos\Controller\Frontend\Order\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
27
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
28
+		\Aimeos\Controller\Frontend\Order\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCreateControllerInvalidName()
33 33
 	{
34
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Order\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
35
+		\Aimeos\Controller\Frontend\Order\Factory::createController(\TestHelperFrontend::getContext(), '%^');
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testCreateControllerNotExisting()
40 40
 	{
41
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Order\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Order\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
controller/frontend/tests/bootstrap.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,22 +11,22 @@
 block discarded – undo
11 11
  * Set error reporting to maximum
12 12
  */
13 13
 error_reporting( -1 );
14
-ini_set( 'display_errors', '1' );
14
+ini_set('display_errors', '1');
15 15
 
16
-date_default_timezone_set( 'UTC' );
16
+date_default_timezone_set('UTC');
17 17
 
18 18
 /**
19 19
  * Set locale settings to reasonable defaults
20 20
  */
21
-setlocale( LC_ALL, 'en_US.UTF-8' );
22
-setlocale( LC_NUMERIC, 'POSIX' );
23
-setlocale( LC_CTYPE, 'en_US.UTF-8' );
24
-setlocale( LC_TIME, 'POSIX' );
21
+setlocale(LC_ALL, 'en_US.UTF-8');
22
+setlocale(LC_NUMERIC, 'POSIX');
23
+setlocale(LC_CTYPE, 'en_US.UTF-8');
24
+setlocale(LC_TIME, 'POSIX');
25 25
 
26 26
 /*
27 27
  * Set include path for tests
28 28
  */
29
-define( 'PATH_TESTS', __DIR__ );
29
+define('PATH_TESTS', __DIR__);
30 30
 
31 31
 require_once 'TestHelperFrontend.php';
32 32
 \TestHelperFrontend::bootstrap();
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Common/Factory/Iface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,5 +27,5 @@
 block discarded – undo
27 27
 	 * @param string|null $name Name of the controller implementation (Default if null)
28 28
 	 * @return \Aimeos\Controller\Frontend\Common\Iface Controller object
29 29
 	 */
30
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null );
30
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null);
31 31
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Common/Factory/Base.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param string $classname Full name of the class for which the object should be returned
32 32
 	 * @param \Aimeos\Controller\Frontend\Iface|null $controller Frontend controller object
33 33
 	 */
34
-	public static function injectController( $classname, \Aimeos\Controller\Frontend\Iface $controller = null )
34
+	public static function injectController($classname, \Aimeos\Controller\Frontend\Iface $controller = null)
35 35
 	{
36 36
 		self::$objects[$classname] = $controller;
37 37
 	}
@@ -46,29 +46,29 @@  discard block
 block discarded – undo
46 46
 	 * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Controller\Frontend\Basket\Decorator\"
47 47
 	 * @return \Aimeos\Controller\Frontend\Common\Iface Controller object
48 48
 	 */
49
-	protected static function addDecorators( \Aimeos\MShop\Context\Item\Iface $context,
50
-		\Aimeos\Controller\Frontend\Iface $controller, array $decorators, $classprefix )
49
+	protected static function addDecorators(\Aimeos\MShop\Context\Item\Iface $context,
50
+		\Aimeos\Controller\Frontend\Iface $controller, array $decorators, $classprefix)
51 51
 	{
52 52
 		$iface = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\Iface';
53 53
 
54
-		foreach( $decorators as $name )
54
+		foreach ($decorators as $name)
55 55
 		{
56
-			if( ctype_alnum( $name ) === false )
56
+			if (ctype_alnum($name) === false)
57 57
 			{
58
-				$classname = is_string( $name ) ? $classprefix . $name : '<not a string>';
59
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
58
+				$classname = is_string($name) ? $classprefix . $name : '<not a string>';
59
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
60 60
 			}
61 61
 
62 62
 			$classname = $classprefix . $name;
63 63
 
64
-			if( class_exists( $classname ) === false ) {
65
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $classname ) );
64
+			if (class_exists($classname) === false) {
65
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $classname));
66 66
 			}
67 67
 
68
-			$controller = new $classname( $controller, $context );
68
+			$controller = new $classname($controller, $context);
69 69
 
70
-			if( !( $controller instanceof $iface ) ) {
71
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) );
70
+			if (!($controller instanceof $iface)) {
71
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $iface));
72 72
 			}
73 73
 		}
74 74
 
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	 * @param string $domain Domain name in lower case, e.g. "product"
85 85
 	 * @return \Aimeos\Controller\Frontend\Common\Iface Controller object
86 86
 	 */
87
-	protected static function addControllerDecorators( \Aimeos\MShop\Context\Item\Iface $context,
88
-		\Aimeos\Controller\Frontend\Iface $controller, $domain )
87
+	protected static function addControllerDecorators(\Aimeos\MShop\Context\Item\Iface $context,
88
+		\Aimeos\Controller\Frontend\Iface $controller, $domain)
89 89
 	{
90
-		if( !is_string( $domain ) || $domain === '' ) {
91
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid domain "%1$s"', $domain ) );
90
+		if (!is_string($domain) || $domain === '') {
91
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid domain "%1$s"', $domain));
92 92
 		}
93 93
 
94
-		$localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $domain ) ) );
94
+		$localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $domain)));
95 95
 		$config = $context->getConfig();
96 96
 
97 97
 		/** controller/frontend/common/decorators/default
@@ -116,26 +116,26 @@  discard block
 block discarded – undo
116 116
 		 * @since 2014.03
117 117
 		 * @category Developer
118 118
 		 */
119
-		$decorators = $config->get( 'controller/frontend/common/decorators/default', array() );
120
-		$excludes = $config->get( 'controller/frontend/' . $domain . '/decorators/excludes', array() );
119
+		$decorators = $config->get('controller/frontend/common/decorators/default', array());
120
+		$excludes = $config->get('controller/frontend/' . $domain . '/decorators/excludes', array());
121 121
 
122
-		foreach( $decorators as $key => $name )
122
+		foreach ($decorators as $key => $name)
123 123
 		{
124
-			if( in_array( $name, $excludes ) ) {
125
-				unset( $decorators[$key] );
124
+			if (in_array($name, $excludes)) {
125
+				unset($decorators[$key]);
126 126
 			}
127 127
 		}
128 128
 
129 129
 		$classprefix = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\';
130
-		$controller = self::addDecorators( $context, $controller, $decorators, $classprefix );
130
+		$controller = self::addDecorators($context, $controller, $decorators, $classprefix);
131 131
 
132 132
 		$classprefix = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\';
133
-		$decorators = $config->get( 'controller/frontend/' . $domain . '/decorators/global', array() );
134
-		$controller = self::addDecorators( $context, $controller, $decorators, $classprefix );
133
+		$decorators = $config->get('controller/frontend/' . $domain . '/decorators/global', array());
134
+		$controller = self::addDecorators($context, $controller, $decorators, $classprefix);
135 135
 
136
-		$classprefix = '\\Aimeos\\Controller\\Frontend\\' . ucfirst( $localClass ) . '\\Decorator\\';
137
-		$decorators = $config->get( 'controller/frontend/' . $domain . '/decorators/local', array() );
138
-		$controller = self::addDecorators( $context, $controller, $decorators, $classprefix );
136
+		$classprefix = '\\Aimeos\\Controller\\Frontend\\' . ucfirst($localClass) . '\\Decorator\\';
137
+		$decorators = $config->get('controller/frontend/' . $domain . '/decorators/local', array());
138
+		$controller = self::addDecorators($context, $controller, $decorators, $classprefix);
139 139
 
140 140
 		return $controller;
141 141
 	}
@@ -149,20 +149,20 @@  discard block
 block discarded – undo
149 149
 	 * @param string $interface Name of the controller interface
150 150
 	 * @return \Aimeos\Controller\Frontend\Common\Iface Controller object
151 151
 	 */
152
-	protected static function createControllerBase( \Aimeos\MShop\Context\Item\Iface $context, $classname, $interface )
152
+	protected static function createControllerBase(\Aimeos\MShop\Context\Item\Iface $context, $classname, $interface)
153 153
 	{
154
-		if( isset( self::$objects[$classname] ) ) {
154
+		if (isset(self::$objects[$classname])) {
155 155
 			return self::$objects[$classname];
156 156
 		}
157 157
 
158
-		if( class_exists( $classname ) === false ) {
159
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $classname ) );
158
+		if (class_exists($classname) === false) {
159
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $classname));
160 160
 		}
161 161
 
162
-		$controller = new $classname( $context );
162
+		$controller = new $classname($context);
163 163
 
164
-		if( !( $controller instanceof $interface ) ) {
165
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) );
164
+		if (!($controller instanceof $interface)) {
165
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $interface));
166 166
 		}
167 167
 
168 168
 		return $controller;
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Exception.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@
 block discarded – undo
32 32
 	 * @param \Exception $previous The previous exception used for the exception chaining.
33 33
 	 * @param array $list The associative list of errors and their messages when several errors occured
34 34
 	 */
35
-	public function __construct( $msg = '', $code = 0, \Exception $previous = null, array $list = array() )
35
+	public function __construct($msg = '', $code = 0, \Exception $previous = null, array $list = array())
36 36
 	{
37
-		parent::__construct( $msg, $code, $previous );
37
+		parent::__construct($msg, $code, $previous);
38 38
 
39 39
 		$this->list = $list;
40 40
 	}
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Basket/Decorator/CategoryTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,35 +12,35 @@
 block discarded – undo
12 12
 	protected function setUp()
13 13
 	{
14 14
 		$this->context = \TestHelperFrontend::getContext();
15
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
16
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category( $object, $this->context );
15
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
16
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category($object, $this->context);
17 17
 	}
18 18
 
19 19
 
20 20
 	protected function tearDown()
21 21
 	{
22 22
 		$this->object->clear();
23
-		$this->context->getSession()->set( 'aimeos', array() );
23
+		$this->context->getSession()->set('aimeos', array());
24 24
 
25
-		unset( $this->object );
25
+		unset($this->object);
26 26
 	}
27 27
 
28 28
 
29 29
 	public function testAddProductWithCategory()
30 30
 	{
31
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
32
-		$item = $manager->findItem( 'CNE' );
31
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
32
+		$item = $manager->findItem('CNE');
33 33
 
34
-		$this->object->addProduct( $item->getId(), 5 );
34
+		$this->object->addProduct($item->getId(), 5);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testAddProductNoCategory()
39 39
 	{
40
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
41
-		$item = $manager->findItem( 'ABCD' );
40
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
41
+		$item = $manager->findItem('ABCD');
42 42
 
43
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Basket\Exception' );
44
-		$this->object->addProduct( $item->getId(), 5 );
43
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Basket\Exception');
44
+		$this->object->addProduct($item->getId(), 5);
45 45
 	}
46 46
 }
Please login to merge, or discard this patch.