@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
30 | 30 | * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items |
31 | 31 | */ |
32 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
33 | - $ref = array( 'media', 'price', 'text' ) ); |
|
32 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
33 | + $ref = array('media', 'price', 'text')); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Returns the list of attribute definitions which must be used to render the input form where the customer can |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
42 | 42 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
43 | 43 | */ |
44 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ); |
|
44 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Returns the price of the service. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @throws \Aimeos\MShop\Exception If service provider isn't available |
55 | 55 | * @throws \Exception If an error occurs |
56 | 56 | */ |
57 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ); |
|
57 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Returns a list of attributes that are invalid. |
@@ -66,5 +66,5 @@ discard block |
||
66 | 66 | * @return array List of key/value pairs of attributes keys and an error message for values that are invalid or |
67 | 67 | * missing |
68 | 68 | */ |
69 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ); |
|
69 | + public function checkServiceAttributes($type, $serviceId, array $attributes); |
|
70 | 70 | } |
@@ -27,5 +27,5 @@ |
||
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 | } |
@@ -31,7 +31,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -32,9 +32,9 @@ |
||
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 | } |
@@ -32,22 +32,22 @@ discard block |
||
32 | 32 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to be stored |
33 | 33 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
34 | 34 | */ |
35 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
35 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
36 | 36 | { |
37 | 37 | $context = $this->getContext(); |
38 | 38 | |
39 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
40 | - $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
39 | + $orderManager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
40 | + $orderBaseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
41 | 41 | |
42 | 42 | |
43 | 43 | $orderBaseManager->begin(); |
44 | - $orderBaseManager->store( $basket ); |
|
44 | + $orderBaseManager->store($basket); |
|
45 | 45 | $orderBaseManager->commit(); |
46 | 46 | |
47 | 47 | $orderItem = $orderManager->createItem(); |
48 | - $orderItem->setBaseId( $basket->getId() ); |
|
49 | - $orderItem->setType( \Aimeos\MShop\Order\Item\Base::TYPE_WEB ); |
|
50 | - $orderManager->saveItem( $orderItem ); |
|
48 | + $orderItem->setBaseId($basket->getId()); |
|
49 | + $orderItem->setType(\Aimeos\MShop\Order\Item\Base::TYPE_WEB); |
|
50 | + $orderManager->saveItem($orderItem); |
|
51 | 51 | |
52 | 52 | |
53 | 53 | return $orderItem; |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
74 | 74 | */ |
75 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
75 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
76 | 76 | { |
77 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem ); |
|
77 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
98 | 98 | */ |
99 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
99 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
100 | 100 | { |
101 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem ); |
|
101 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
118 | 118 | */ |
119 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
119 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
120 | 120 | { |
121 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem ); |
|
121 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem); |
|
122 | 122 | } |
123 | 123 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to be stored |
32 | 32 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
33 | 33 | */ |
34 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ); |
|
34 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
56 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
76 | 76 | * @return void |
77 | 77 | */ |
78 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
78 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
79 | 79 | |
80 | 80 | |
81 | 81 | /** |
@@ -93,5 +93,5 @@ discard block |
||
93 | 93 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
94 | 94 | * @return void |
95 | 95 | */ |
96 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
96 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
97 | 97 | } |
@@ -17,92 +17,92 @@ |
||
17 | 17 | { |
18 | 18 | public function testCreateController() |
19 | 19 | { |
20 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket' ); |
|
21 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Frontend\\Iface', $controller ); |
|
20 | + $controller = \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket'); |
|
21 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Frontend\\Iface', $controller); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | public function testCreateControllerEmpty() |
26 | 26 | { |
27 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
28 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), "\t\n" ); |
|
27 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
28 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), "\t\n"); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | public function testCreateControllerInvalidName() |
33 | 33 | { |
34 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
35 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
34 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
35 | + \Aimeos\Controller\Frontend\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\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
41 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
42 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | public function testCreateSubControllerNotExisting() |
47 | 47 | { |
48 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
49 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket/notexist' ); |
|
48 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
49 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket/notexist'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testClear() |
54 | 54 | { |
55 | - $cache = \Aimeos\Controller\Frontend\Factory::setCache( true ); |
|
55 | + $cache = \Aimeos\Controller\Frontend\Factory::setCache(true); |
|
56 | 56 | |
57 | 57 | $context = \TestHelperFrontend::getContext(); |
58 | 58 | |
59 | - $controller1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
59 | + $controller1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
60 | 60 | \Aimeos\Controller\Frontend\Factory::clear(); |
61 | - $controller2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
61 | + $controller2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
62 | 62 | |
63 | - \Aimeos\Controller\Frontend\Factory::setCache( $cache ); |
|
63 | + \Aimeos\Controller\Frontend\Factory::setCache($cache); |
|
64 | 64 | |
65 | - $this->assertNotSame( $controller1, $controller2 ); |
|
65 | + $this->assertNotSame($controller1, $controller2); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testClearSite() |
70 | 70 | { |
71 | - $cache = \Aimeos\Controller\Frontend\Factory::setCache( true ); |
|
71 | + $cache = \Aimeos\Controller\Frontend\Factory::setCache(true); |
|
72 | 72 | |
73 | 73 | $context = \TestHelperFrontend::getContext(); |
74 | 74 | |
75 | - $basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
76 | - $catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
77 | - \Aimeos\Controller\Frontend\Factory::clear( (string) $context ); |
|
75 | + $basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
76 | + $catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
77 | + \Aimeos\Controller\Frontend\Factory::clear((string) $context); |
|
78 | 78 | |
79 | - $basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
80 | - $catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
79 | + $basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
80 | + $catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
81 | 81 | |
82 | - \Aimeos\Controller\Frontend\Factory::setCache( $cache ); |
|
82 | + \Aimeos\Controller\Frontend\Factory::setCache($cache); |
|
83 | 83 | |
84 | - $this->assertNotSame( $basket1, $basket2 ); |
|
85 | - $this->assertNotSame( $catalog1, $catalog2 ); |
|
84 | + $this->assertNotSame($basket1, $basket2); |
|
85 | + $this->assertNotSame($catalog1, $catalog2); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | 89 | public function testClearSpecific() |
90 | 90 | { |
91 | - $cache = \Aimeos\Controller\Frontend\Factory::setCache( true ); |
|
91 | + $cache = \Aimeos\Controller\Frontend\Factory::setCache(true); |
|
92 | 92 | |
93 | 93 | $context = \TestHelperFrontend::getContext(); |
94 | 94 | |
95 | - $basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
96 | - $catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
97 | - \Aimeos\Controller\Frontend\Factory::clear( (string) $context, 'basket' ); |
|
95 | + $basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
96 | + $catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
97 | + \Aimeos\Controller\Frontend\Factory::clear((string) $context, 'basket'); |
|
98 | 98 | |
99 | - $basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
100 | - $catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
99 | + $basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
100 | + $catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
101 | 101 | |
102 | - \Aimeos\Controller\Frontend\Factory::setCache( $cache ); |
|
102 | + \Aimeos\Controller\Frontend\Factory::setCache($cache); |
|
103 | 103 | |
104 | - $this->assertNotSame( $basket1, $basket2 ); |
|
105 | - $this->assertSame( $catalog1, $catalog2 ); |
|
104 | + $this->assertNotSame($basket1, $basket2); |
|
105 | + $this->assertSame($catalog1, $catalog2); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | } |
109 | 109 | \ No newline at end of file |
@@ -12,35 +12,35 @@ |
||
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 | } |
@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | public static function bootstrap() |
16 | 16 | { |
17 | 17 | self::getAimeos(); |
18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
19 | - \Aimeos\Controller\Frontend\Factory::setCache( false ); |
|
18 | + \Aimeos\MShop\Factory::setCache(false); |
|
19 | + \Aimeos\Controller\Frontend\Factory::setCache(false); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | - public static function getContext( $site = 'unittest' ) |
|
23 | + public static function getContext($site = 'unittest') |
|
24 | 24 | { |
25 | - if( !isset( self::$context[$site] ) ) { |
|
26 | - self::$context[$site] = self::createContext( $site ); |
|
25 | + if (!isset(self::$context[$site])) { |
|
26 | + self::$context[$site] = self::createContext($site); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return clone self::$context[$site]; |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | |
33 | 33 | private static function getAimeos() |
34 | 34 | { |
35 | - if( !isset( self::$aimeos ) ) |
|
35 | + if (!isset(self::$aimeos)) |
|
36 | 36 | { |
37 | 37 | require_once 'Bootstrap.php'; |
38 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
38 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
39 | 39 | |
40 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
41 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
40 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
41 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return self::$aimeos; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @param string $site |
50 | 50 | */ |
51 | - private static function createContext( $site ) |
|
51 | + private static function createContext($site) |
|
52 | 52 | { |
53 | 53 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
54 | 54 | $aimeos = self::getAimeos(); |
@@ -58,34 +58,34 @@ discard block |
||
58 | 58 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
59 | 59 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
60 | 60 | |
61 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
62 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
63 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
64 | - $ctx->setConfig( $conf ); |
|
61 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
62 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
63 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
64 | + $ctx->setConfig($conf); |
|
65 | 65 | |
66 | 66 | |
67 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
68 | - $ctx->setDatabaseManager( $dbm ); |
|
67 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
68 | + $ctx->setDatabaseManager($dbm); |
|
69 | 69 | |
70 | 70 | |
71 | - $logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
72 | - $ctx->setLogger( $logger ); |
|
71 | + $logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
72 | + $ctx->setLogger($logger); |
|
73 | 73 | |
74 | 74 | |
75 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
76 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
75 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
76 | + $ctx->setI18n(array('de' => $i18n)); |
|
77 | 77 | |
78 | 78 | |
79 | 79 | $session = new \Aimeos\MW\Session\None(); |
80 | - $ctx->setSession( $session ); |
|
80 | + $ctx->setSession($session); |
|
81 | 81 | |
82 | 82 | |
83 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
84 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
85 | - $ctx->setLocale( $locale ); |
|
83 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
84 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
85 | + $ctx->setLocale($locale); |
|
86 | 86 | |
87 | 87 | |
88 | - $ctx->setEditor( 'core:controller/frontend' ); |
|
88 | + $ctx->setEditor('core:controller/frontend'); |
|
89 | 89 | |
90 | 90 | return $ctx; |
91 | 91 | } |