Completed
Push — master ( eb1cb8...a47bac )
by Aimeos
02:06
created
controller/frontend/tests/Controller/Frontend/Locale/StandardTest.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$this->object = new \Aimeos\Controller\Frontend\Locale\Standard( \TestHelperFrontend::getContext() );
19
+		$this->object = new \Aimeos\Controller\Frontend\Locale\Standard(\TestHelperFrontend::getContext());
20 20
 	}
21 21
 
22 22
 
23 23
 	protected function tearDown()
24 24
 	{
25
-		unset( $this->object );
25
+		unset($this->object);
26 26
 	}
27 27
 
28 28
 
@@ -30,29 +30,29 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$filter = $this->object->createFilter();
32 32
 
33
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
34
-		$this->assertEquals( 1, count( $filter->getSortations() ) );
35
-		$this->assertEquals( 0, $filter->getSliceStart() );
36
-		$this->assertEquals( 100, $filter->getSliceSize() );
33
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
34
+		$this->assertEquals(1, count($filter->getSortations()));
35
+		$this->assertEquals(0, $filter->getSliceStart());
36
+		$this->assertEquals(100, $filter->getSliceSize());
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testGetItem()
41 41
 	{
42
-		$localeManager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'locale' );
43
-		$search = $localeManager->createSearch( true );
44
-		$search->setSortations( [$search->sort( '+', 'locale.position' )] );
45
-		$search->setSlice( 0, 1 );
46
-		$localeItems = $localeManager->searchItems( $search );
47
-
48
-		if( ( $localeItem = reset( $localeItems ) ) === false ) {
49
-			throw new \Exception( 'No locale item found' );
42
+		$localeManager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'locale');
43
+		$search = $localeManager->createSearch(true);
44
+		$search->setSortations([$search->sort('+', 'locale.position')]);
45
+		$search->setSlice(0, 1);
46
+		$localeItems = $localeManager->searchItems($search);
47
+
48
+		if (($localeItem = reset($localeItems)) === false) {
49
+			throw new \Exception('No locale item found');
50 50
 		}
51 51
 
52 52
 
53
-		$result = $this->object->getItem( $localeItem->getId() );
53
+		$result = $this->object->getItem($localeItem->getId());
54 54
 
55
-		$this->assertInstanceOf( '\Aimeos\MShop\Locale\Item\Iface', $result );
55
+		$this->assertInstanceOf('\Aimeos\MShop\Locale\Item\Iface', $result);
56 56
 	}
57 57
 
58 58
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 		$total = 0;
62 62
 		$filter = $this->object->createFilter();
63
-		$results = $this->object->searchItems( $filter, [], $total );
63
+		$results = $this->object->searchItems($filter, [], $total);
64 64
 
65
-		$this->assertEquals( 1, $total );
66
-		$this->assertEquals( 1, count( $results ) );
65
+		$this->assertEquals(1, $total);
66
+		$this->assertEquals(1, count($results));
67 67
 	}
68 68
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Customer/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param string|null $name Name of the controller implementaton (default: "Standard")
29 29
 	 * @return \Aimeos\Controller\Frontend\Customer\Iface Controller object
30 30
 	 */
31
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
31
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null)
32 32
 	{
33 33
 		/** controller/frontend/customer/name
34 34
 		 * Class name of the used customer frontend controller implementation
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 		 * @since 2014.03
64 64
 		 * @category Developer
65 65
 		 */
66
-		if( $name === null ) {
67
-			$name = $context->getConfig()->get( 'controller/frontend/customer/name', 'Standard' );
66
+		if ($name === null) {
67
+			$name = $context->getConfig()->get('controller/frontend/customer/name', 'Standard');
68 68
 		}
69 69
 
70
-		if( ctype_alnum( $name ) === false )
70
+		if (ctype_alnum($name) === false)
71 71
 		{
72
-			$classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Customer\\' . $name : '<not a string>';
73
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
72
+			$classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Customer\\' . $name : '<not a string>';
73
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
74 74
 		}
75 75
 
76 76
 		$iface = '\\Aimeos\\Controller\\Frontend\\Customer\\Iface';
77 77
 		$classname = '\\Aimeos\\Controller\\Frontend\\Customer\\' . $name;
78 78
 
79
-		$manager = self::createControllerBase( $context, $classname, $iface );
79
+		$manager = self::createControllerBase($context, $classname, $iface);
80 80
 
81 81
 		/** controller/frontend/customer/decorators/excludes
82 82
 		 * Excludes decorators added by the "common" option from the customer frontend controllers
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		 * @see controller/frontend/customer/decorators/excludes
153 153
 		 * @see controller/frontend/customer/decorators/global
154 154
 		 */
155
-		return self::addControllerDecorators( $context, $manager, 'customer' );
155
+		return self::addControllerDecorators($context, $manager, 'customer');
156 156
 	}
157 157
 
158 158
 }
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Basket/Decorator/BundleTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,40 +18,40 @@
 block discarded – undo
18 18
 	protected function setUp()
19 19
 	{
20 20
 		$this->context = \TestHelperFrontend::getContext();
21
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
22
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Bundle( $object, $this->context );
21
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
22
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Bundle($object, $this->context);
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function tearDown()
27 27
 	{
28 28
 		$this->object->clear();
29
-		$this->context->getSession()->set( 'aimeos', [] );
29
+		$this->context->getSession()->set('aimeos', []);
30 30
 
31
-		unset( $this->object );
31
+		unset($this->object);
32 32
 	}
33 33
 
34 34
 
35 35
 	public function testAddProductBundle()
36 36
 	{
37
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:BUNDLE' );
37
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:BUNDLE');
38 38
 
39
-		$this->object->addProduct( $item->getId(), 1 );
39
+		$this->object->addProduct($item->getId(), 1);
40 40
 
41
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
42
-		$this->assertEquals( 'U:BUNDLE', $this->object->get()->getProduct( 0 )->getProductCode() );
43
-		$this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getProducts() ) );
41
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
42
+		$this->assertEquals('U:BUNDLE', $this->object->get()->getProduct(0)->getProductCode());
43
+		$this->assertEquals(2, count($this->object->get()->getProduct(0)->getProducts()));
44 44
 	}
45 45
 
46 46
 
47 47
 	public function testAddProductNoBundle()
48 48
 	{
49
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
49
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
50 50
 
51
-		$this->object->addProduct( $item->getId(), 1 );
51
+		$this->object->addProduct($item->getId(), 1);
52 52
 
53
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
54
-		$this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() );
55
-		$this->assertEquals( 0, count( $this->object->get()->getProduct( 0 )->getProducts() ) );
53
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
54
+		$this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode());
55
+		$this->assertEquals(0, count($this->object->get()->getProduct(0)->getProducts()));
56 56
 	}
57 57
 }
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
@@ -18,35 +18,35 @@
 block discarded – undo
18 18
 	protected function setUp()
19 19
 	{
20 20
 		$this->context = \TestHelperFrontend::getContext();
21
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
22
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category( $object, $this->context );
21
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
22
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category($object, $this->context);
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function tearDown()
27 27
 	{
28 28
 		$this->object->clear();
29
-		$this->context->getSession()->set( 'aimeos', [] );
29
+		$this->context->getSession()->set('aimeos', []);
30 30
 
31
-		unset( $this->object );
31
+		unset($this->object);
32 32
 	}
33 33
 
34 34
 
35 35
 	public function testAddProductWithCategory()
36 36
 	{
37
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
38
-		$item = $manager->findItem( 'CNE' );
37
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
38
+		$item = $manager->findItem('CNE');
39 39
 
40
-		$this->object->addProduct( $item->getId(), 5 );
40
+		$this->object->addProduct($item->getId(), 5);
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testAddProductNoCategory()
45 45
 	{
46
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
47
-		$item = $manager->findItem( 'ABCD' );
46
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
47
+		$item = $manager->findItem('ABCD');
48 48
 
49
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Basket\Exception' );
50
-		$this->object->addProduct( $item->getId(), 5 );
49
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Basket\Exception');
50
+		$this->object->addProduct($item->getId(), 5);
51 51
 	}
52 52
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Common/Factory/BaseTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,33 +20,33 @@
 block discarded – undo
20 20
 		$this->context = \TestHelperFrontend::getContext();
21 21
 		$config = $this->context->getConfig();
22 22
 
23
-		$config->set( 'controller/frontend/common/decorators/default', [] );
24
-		$config->set( 'controller/frontend/catalog/decorators/global', [] );
25
-		$config->set( 'controller/frontend/catalog/decorators/local', [] );
23
+		$config->set('controller/frontend/common/decorators/default', []);
24
+		$config->set('controller/frontend/catalog/decorators/global', []);
25
+		$config->set('controller/frontend/catalog/decorators/local', []);
26 26
 
27 27
 	}
28 28
 
29 29
 
30 30
 	public function testInjectController()
31 31
 	{
32
-		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' );
33
-		\Aimeos\Controller\Frontend\Catalog\Factory::injectController( '\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller );
32
+		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard');
33
+		\Aimeos\Controller\Frontend\Catalog\Factory::injectController('\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller);
34 34
 
35
-		$injectedController = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' );
35
+		$injectedController = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard');
36 36
 
37
-		$this->assertSame( $controller, $injectedController );
37
+		$this->assertSame($controller, $injectedController);
38 38
 	}
39 39
 
40 40
 
41 41
 	public function testInjectControllerReset()
42 42
 	{
43
-		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' );
44
-		\Aimeos\Controller\Frontend\Catalog\Factory::injectController( '\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller );
45
-		\Aimeos\Controller\Frontend\Catalog\Factory::injectController( '\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', null );
43
+		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard');
44
+		\Aimeos\Controller\Frontend\Catalog\Factory::injectController('\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller);
45
+		\Aimeos\Controller\Frontend\Catalog\Factory::injectController('\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', null);
46 46
 
47
-		$new = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' );
47
+		$new = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard');
48 48
 
49
-		$this->assertNotSame( $controller, $new );
49
+		$this->assertNotSame($controller, $new);
50 50
 	}
51 51
 
52 52
 }
53 53
\ No newline at end of file
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 = [] )
35
+	public function __construct($msg = '', $code = 0, \Exception $previous = null, array $list = [])
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.
controller/frontend/src/Controller/Frontend/Locale/Iface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items
37 37
 	 * @since 2017.03
38 38
 	 */
39
-	public function getItem( $id, array $domains = [] );
39
+	public function getItem($id, array $domains = []);
40 40
 
41 41
 
42 42
 	/**
@@ -48,5 +48,5 @@  discard block
 block discarded – undo
48 48
 	 * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface
49 49
 	 * @since 2017.03
50 50
 	 */
51
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null );
51
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null);
52 52
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Locale/Standard.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
 	public function createFilter()
32 32
 	{
33 33
 		$context = $this->getContext();
34
-		$filter = \Aimeos\MShop\Factory::createManager( $context, 'locale' )->createSearch( true );
34
+		$filter = \Aimeos\MShop\Factory::createManager($context, 'locale')->createSearch(true);
35 35
 
36 36
 		$expr = array(
37
-			$filter->compare( '==', 'locale.siteid', $context->getLocale()->getSitePath() ),
37
+			$filter->compare('==', 'locale.siteid', $context->getLocale()->getSitePath()),
38 38
 			$filter->getConditions(),
39 39
 		);
40 40
 
41
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
42
-		$filter->setSortations( array( $filter->sort( '+', 'locale.position' ) ) );
41
+		$filter->setConditions($filter->combine('&&', $expr));
42
+		$filter->setSortations(array($filter->sort('+', 'locale.position')));
43 43
 
44 44
 		return $filter;
45 45
 	}
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items
54 54
 	 * @since 2017.03
55 55
 	 */
56
-	public function getItem( $id, array $domains = [] )
56
+	public function getItem($id, array $domains = [])
57 57
 	{
58
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->getItem( $id, $domains, true );
58
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->getItem($id, $domains, true);
59 59
 	}
60 60
 
61 61
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface
69 69
 	 * @since 2017.03
70 70
 	 */
71
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null )
71
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null)
72 72
 	{
73
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->searchItems( $filter, $domains, $total );
73
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->searchItems($filter, $domains, $total);
74 74
 	}
75 75
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Factory.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 	 * @param integer $id Context ID the objects have been created with (string of \Aimeos\MShop\Context\Item\Iface)
31 31
 	 * @param string $path Path describing the controller to clear, e.g. "basket"
32 32
 	 */
33
-	static public function clear( $id = null, $path = null )
33
+	static public function clear($id = null, $path = null)
34 34
 	{
35
-		if( $id !== null )
35
+		if ($id !== null)
36 36
 		{
37
-			if( $path !== null ) {
37
+			if ($path !== null) {
38 38
 				self::$controllers[$id][$path] = null;
39 39
 			} else {
40 40
 				self::$controllers[$id] = [];
@@ -62,37 +62,37 @@  discard block
 block discarded – undo
62 62
 	 * @return \Aimeos\Controller\Frontend\Iface New frontend controller
63 63
 	 * @throws \Aimeos\Controller\Frontend\Exception If the given path is invalid or the manager wasn't found
64 64
 	 */
65
-	static public function createController( \Aimeos\MShop\Context\Item\Iface $context, $path )
65
+	static public function createController(\Aimeos\MShop\Context\Item\Iface $context, $path)
66 66
 	{
67
-		if( empty( $path ) ) {
68
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Controller path is empty' ) );
67
+		if (empty($path)) {
68
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Controller path is empty'));
69 69
 		}
70 70
 
71 71
 		$id = (string) $context;
72 72
 
73
-		if( self::$cache === false || !isset( self::$controllers[$id][$path] ) )
73
+		if (self::$cache === false || !isset(self::$controllers[$id][$path]))
74 74
 		{
75
-			$parts = explode( '/', $path );
75
+			$parts = explode('/', $path);
76 76
 
77
-			foreach( $parts as $key => $part )
77
+			foreach ($parts as $key => $part)
78 78
 			{
79
-				if( ctype_alnum( $part ) === false ) {
80
-					throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in controller name "%1$s" in "%2$s"', $part, $path ) );
79
+				if (ctype_alnum($part) === false) {
80
+					throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in controller name "%1$s" in "%2$s"', $part, $path));
81 81
 				}
82 82
 
83
-				$parts[$key] = ucwords( $part );
83
+				$parts[$key] = ucwords($part);
84 84
 			}
85 85
 
86
-			$factory = '\\Aimeos\\Controller\\Frontend\\' . join( '\\', $parts ) . '\\Factory';
86
+			$factory = '\\Aimeos\\Controller\\Frontend\\' . join('\\', $parts) . '\\Factory';
87 87
 
88
-			if( class_exists( $factory ) === false ) {
89
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $factory ) );
88
+			if (class_exists($factory) === false) {
89
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $factory));
90 90
 			}
91 91
 
92
-			$manager = call_user_func_array( array( $factory, 'createController' ), array( $context ) );
92
+			$manager = call_user_func_array(array($factory, 'createController'), array($context));
93 93
 
94
-			if( $manager === false ) {
95
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) );
94
+			if ($manager === false) {
95
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid factory "%1$s"', $factory));
96 96
 			}
97 97
 
98 98
 			self::$controllers[$id][$path] = $manager;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @param boolean $value True to enable caching, false to disable it.
109 109
 	 * @return boolean Previous cache setting
110 110
 	 */
111
-	static public function setCache( $value )
111
+	static public function setCache($value)
112 112
 	{
113 113
 		$old = self::$cache;
114 114
 		self::$cache = (boolean) $value;
Please login to merge, or discard this patch.