@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
32 | 32 | */ |
33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
34 | 34 | { |
35 | 35 | $iface = '\Aimeos\Controller\Frontend\Order\Iface'; |
36 | - if( !( $controller instanceof $iface ) ) |
|
36 | + if (!($controller instanceof $iface)) |
|
37 | 37 | { |
38 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
39 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
38 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
39 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->controller = $controller; |
43 | 43 | |
44 | - parent::__construct( $context ); |
|
44 | + parent::__construct($context); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return mixed Returns the value of the called method |
54 | 54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
55 | 55 | */ |
56 | - public function __call( $name, array $param ) |
|
56 | + public function __call($name, array $param) |
|
57 | 57 | { |
58 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
58 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * @param string $type Arbitrary order type (max. eight chars) |
67 | 67 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
68 | 68 | */ |
69 | - public function addItem( $baseId, $type ) |
|
69 | + public function addItem($baseId, $type) |
|
70 | 70 | { |
71 | - return $this->controller->addItem( $baseId, $type ); |
|
71 | + return $this->controller->addItem($baseId, $type); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | * @param string $id Unique order ID |
90 | 90 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
91 | 91 | */ |
92 | - public function getItem( $id ) |
|
92 | + public function getItem($id) |
|
93 | 93 | { |
94 | - return $this->controller->getItem( $id ); |
|
94 | + return $this->controller->getItem($id); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | * @param integer &$total|null Variable that will contain the total number of available items |
103 | 103 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
104 | 104 | */ |
105 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
105 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
106 | 106 | { |
107 | - return $this->controller->searchItems( $filter, $total ); |
|
107 | + return $this->controller->searchItems($filter, $total); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
130 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
131 | 131 | { |
132 | - $this->getController()->block( $orderItem ); |
|
132 | + $this->getController()->block($orderItem); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
155 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
156 | 156 | { |
157 | - $this->getController()->unblock( $orderItem ); |
|
157 | + $this->getController()->unblock($orderItem); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
174 | 174 | * @return void |
175 | 175 | */ |
176 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
176 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
177 | 177 | { |
178 | - $this->getController()->update( $orderItem ); |
|
178 | + $this->getController()->update($orderItem); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
191 | 191 | * @deprecated 2017.04 Use store() from basket controller instead |
192 | 192 | */ |
193 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
193 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
194 | 194 | { |
195 | - return $this->getController()->store( $basket ); |
|
195 | + return $this->getController()->store($basket); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param string $type Arbitrary order type (max. eight chars) |
28 | 28 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
29 | 29 | */ |
30 | - public function addItem( $baseId, $type ); |
|
30 | + public function addItem($baseId, $type); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $id Unique order ID |
45 | 45 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
46 | 46 | */ |
47 | - public function getItem( $id ); |
|
47 | + public function getItem($id); |
|
48 | 48 | |
49 | 49 | |
50 | 50 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param integer &$total|null Variable that will contain the total number of available items |
55 | 55 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
56 | 56 | */ |
57 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ); |
|
57 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
77 | 77 | * @return void |
78 | 78 | */ |
79 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
79 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
80 | 80 | |
81 | 81 | |
82 | 82 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
101 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
102 | 102 | |
103 | 103 | |
104 | 104 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
117 | 117 | * @return void |
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 | 121 | |
122 | 122 | /** |
@@ -130,5 +130,5 @@ discard block |
||
130 | 130 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
131 | 131 | * @deprecated 2017.04 Use store() from basket controller instead |
132 | 132 | */ |
133 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ); |
|
133 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket); |
|
134 | 134 | } |
@@ -20,136 +20,136 @@ |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | 22 | |
23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Order\Standard' ) |
|
23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Order\Standard') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Order\Decorator\Base' ) |
|
28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Order\Decorator\Base') |
|
28 | + ->setConstructorArgs([$this->stub, $this->context]) |
|
29 | 29 | ->getMockForAbstractClass(); |
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | protected function tearDown() |
34 | 34 | { |
35 | - unset( $this->context, $this->object, $this->stub ); |
|
35 | + unset($this->context, $this->object, $this->stub); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testConstructException() |
40 | 40 | { |
41 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock(); |
|
41 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock(); |
|
42 | 42 | |
43 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' ); |
|
43 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Exception'); |
|
44 | 44 | |
45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Order\Decorator\Base' ) |
|
46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Order\Decorator\Base') |
|
46 | + ->setConstructorArgs([$stub, $this->context]) |
|
47 | 47 | ->getMockForAbstractClass(); |
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testCall() |
52 | 52 | { |
53 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Order\Standard' ) |
|
53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Order\Standard') |
|
54 | 54 | ->disableOriginalConstructor() |
55 | - ->setMethods( ['invalid'] ) |
|
55 | + ->setMethods(['invalid']) |
|
56 | 56 | ->getMock(); |
57 | 57 | |
58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Order\Decorator\Base' ) |
|
59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Order\Decorator\Base') |
|
59 | + ->setConstructorArgs([$stub, $this->context]) |
|
60 | 60 | ->getMockForAbstractClass(); |
61 | 61 | |
62 | - $stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) ); |
|
62 | + $stub->expects($this->once())->method('invalid')->will($this->returnValue(true)); |
|
63 | 63 | |
64 | - $this->assertTrue( $object->invalid() ); |
|
64 | + $this->assertTrue($object->invalid()); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | 68 | public function testAddItem() |
69 | 69 | { |
70 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
70 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
71 | 71 | |
72 | - $this->stub->expects( $this->once() )->method( 'addItem' )->will( $this->returnValue( $item ) ); |
|
72 | + $this->stub->expects($this->once())->method('addItem')->will($this->returnValue($item)); |
|
73 | 73 | |
74 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, '' ) ); |
|
74 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, '' )); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testCreateFilter() |
79 | 79 | { |
80 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createSearch(); |
|
80 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createSearch(); |
|
81 | 81 | |
82 | - $this->stub->expects( $this->once() )->method( 'createFilter' )->will( $this->returnValue( $search ) ); |
|
82 | + $this->stub->expects($this->once())->method('createFilter')->will($this->returnValue($search)); |
|
83 | 83 | |
84 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() ); |
|
84 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter()); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
88 | 88 | public function testGetItem() |
89 | 89 | { |
90 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
90 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
91 | 91 | |
92 | - $this->stub->expects( $this->once() )->method( 'getItem' )->will( $this->returnValue( $item ) ); |
|
92 | + $this->stub->expects($this->once())->method('getItem')->will($this->returnValue($item)); |
|
93 | 93 | |
94 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->getItem( -1 ) ); |
|
94 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->getItem( -1 )); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
98 | 98 | public function testSearchItems() |
99 | 99 | { |
100 | - $search = $this->getMockBuilder( '\Aimeos\MW\Criteria\Iface' )->getMock(); |
|
100 | + $search = $this->getMockBuilder('\Aimeos\MW\Criteria\Iface')->getMock(); |
|
101 | 101 | |
102 | - $this->stub->expects( $this->once() )->method( 'searchItems' )->will( $this->returnValue( [] ) ); |
|
102 | + $this->stub->expects($this->once())->method('searchItems')->will($this->returnValue([])); |
|
103 | 103 | |
104 | - $this->assertEquals( [], $this->object->searchItems( $search ) ); |
|
104 | + $this->assertEquals([], $this->object->searchItems($search)); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | public function testUnblock() |
109 | 109 | { |
110 | - $orderItem = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
110 | + $orderItem = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
111 | 111 | |
112 | - $this->stub->expects( $this->once() )->method( 'unblock' ); |
|
112 | + $this->stub->expects($this->once())->method('unblock'); |
|
113 | 113 | |
114 | - $this->object->unblock( $orderItem ); |
|
114 | + $this->object->unblock($orderItem); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | 118 | public function testUpdate() |
119 | 119 | { |
120 | - $orderItem = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
120 | + $orderItem = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
121 | 121 | |
122 | - $this->stub->expects( $this->once() )->method( 'update' ); |
|
122 | + $this->stub->expects($this->once())->method('update'); |
|
123 | 123 | |
124 | - $this->object->update( $orderItem ); |
|
124 | + $this->object->update($orderItem); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | 128 | public function testStore() |
129 | 129 | { |
130 | - $orderItem = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
131 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
130 | + $orderItem = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
131 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
132 | 132 | |
133 | - $this->stub->expects( $this->once() )->method( 'store' ) |
|
134 | - ->will( $this->returnValue( $orderItem ) ); |
|
133 | + $this->stub->expects($this->once())->method('store') |
|
134 | + ->will($this->returnValue($orderItem)); |
|
135 | 135 | |
136 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->store( $basket ) ); |
|
136 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->store($basket)); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
140 | 140 | public function testGetController() |
141 | 141 | { |
142 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
142 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
143 | 143 | |
144 | - $this->assertSame( $this->stub, $result ); |
|
144 | + $this->assertSame($this->stub, $result); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
148 | - protected function access( $name ) |
|
148 | + protected function access($name) |
|
149 | 149 | { |
150 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Order\Decorator\Base' ); |
|
151 | - $method = $class->getMethod( $name ); |
|
152 | - $method->setAccessible( true ); |
|
150 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Order\Decorator\Base'); |
|
151 | + $method = $class->getMethod($name); |
|
152 | + $method->setAccessible(true); |
|
153 | 153 | |
154 | 154 | return $method; |
155 | 155 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
31 | 31 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
32 | 32 | */ |
33 | - public function checkAttributes( $serviceId, array $attributes ); |
|
33 | + public function checkAttributes($serviceId, array $attributes); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Returns the service item for the given ID |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
40 | 40 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
41 | 41 | */ |
42 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ); |
|
42 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']); |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Returns the service providers for the given type |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
49 | 49 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
50 | 50 | */ |
51 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ); |
|
51 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Processes the service for the given order, e.g. payment and delivery services |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc. |
62 | 62 | * or null if no form data is required |
63 | 63 | */ |
64 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ); |
|
64 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params); |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Updates the payment or delivery status for the given request |
@@ -72,5 +72,5 @@ discard block |
||
72 | 72 | * (keys are <type>.url-self, <type>.url-success, <type>.url-update where type can be "delivery" or "payment") |
73 | 73 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
74 | 74 | */ |
75 | - public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls ); |
|
75 | + public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls); |
|
76 | 76 | } |
@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
34 | 34 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
35 | 35 | */ |
36 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
36 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
37 | 37 | { |
38 | 38 | $iface = '\Aimeos\Controller\Frontend\Service\Iface'; |
39 | - if( !( $controller instanceof $iface ) ) |
|
39 | + if (!($controller instanceof $iface)) |
|
40 | 40 | { |
41 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
42 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
41 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
42 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $this->controller = $controller; |
46 | 46 | |
47 | - parent::__construct( $context ); |
|
47 | + parent::__construct($context); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @return mixed Returns the value of the called method |
57 | 57 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
58 | 58 | */ |
59 | - public function __call( $name, array $param ) |
|
59 | + public function __call($name, array $param) |
|
60 | 60 | { |
61 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
61 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
70 | 70 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
71 | 71 | */ |
72 | - public function checkAttributes( $serviceId, array $attributes ) |
|
72 | + public function checkAttributes($serviceId, array $attributes) |
|
73 | 73 | { |
74 | - return $this->controller->checkAttributes( $serviceId, $attributes ); |
|
74 | + return $this->controller->checkAttributes($serviceId, $attributes); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
83 | 83 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
84 | 84 | */ |
85 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
85 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
86 | 86 | { |
87 | - return $this->controller->getProvider( $serviceId, $ref ); |
|
87 | + return $this->controller->getProvider($serviceId, $ref); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
96 | 96 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
97 | 97 | */ |
98 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ) |
|
98 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']) |
|
99 | 99 | { |
100 | - return $this->controller->getProviders( $type, $ref ); |
|
100 | + return $this->controller->getProviders($type, $ref); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc. |
113 | 113 | * or null if no form data is required |
114 | 114 | */ |
115 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ) |
|
115 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params) |
|
116 | 116 | { |
117 | - return $this->controller->process( $orderItem, $serviceId, $urls, $params ); |
|
117 | + return $this->controller->process($orderItem, $serviceId, $urls, $params); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | * (keys are <type>.url-self, <type>.url-success, <type>.url-update where type can be "delivery" or "payment") |
128 | 128 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
129 | 129 | */ |
130 | - public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls ) |
|
130 | + public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls) |
|
131 | 131 | { |
132 | - return $this->controller->updateSync( $request, $response, $urls ); |
|
132 | + return $this->controller->updateSync($request, $response, $urls); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items |
143 | 143 | * @deprecated Use getProviders() instead |
144 | 144 | */ |
145 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
146 | - $ref = array( 'media', 'price', 'text' ) ) |
|
145 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
146 | + $ref = array('media', 'price', 'text')) |
|
147 | 147 | { |
148 | - return $this->controller->getServices( $type, $basket, $ref ); |
|
148 | + return $this->controller->getServices($type, $basket, $ref); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
160 | 160 | * @deprecated Use getProvider() instead |
161 | 161 | */ |
162 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
162 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
163 | 163 | { |
164 | - return $this->controller->getServiceAttributes( $type, $serviceId, $basket ); |
|
164 | + return $this->controller->getServiceAttributes($type, $serviceId, $basket); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | * @throws \Exception If an error occurs |
178 | 178 | * @deprecated Use getProvider() instead |
179 | 179 | */ |
180 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
180 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
181 | 181 | { |
182 | - return $this->controller->getServicePrice( $type, $serviceId, $basket ); |
|
182 | + return $this->controller->getServicePrice($type, $serviceId, $basket); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | * missing |
195 | 195 | * @deprecated Use checkAttributes() instead |
196 | 196 | */ |
197 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
197 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
198 | 198 | { |
199 | - return $this->controller->checkServiceAttributes( $type, $serviceId, $attributes ); |
|
199 | + return $this->controller->checkServiceAttributes($type, $serviceId, $attributes); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 |
@@ -18,40 +18,40 @@ |
||
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 | } |
@@ -18,35 +18,35 @@ |
||
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 | } |
@@ -19,217 +19,217 @@ |
||
19 | 19 | protected function setUp() |
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | - $this->testItem = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' ); |
|
22 | + $this->testItem = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP'); |
|
23 | 23 | |
24 | - $object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
|
25 | - $this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Select( $object, $this->context ); |
|
24 | + $object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context); |
|
25 | + $this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Select($object, $this->context); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | 29 | protected function tearDown() |
30 | 30 | { |
31 | 31 | $this->object->clear(); |
32 | - $this->context->getSession()->set( 'aimeos', [] ); |
|
32 | + $this->context->getSession()->set('aimeos', []); |
|
33 | 33 | |
34 | - unset( $this->object ); |
|
34 | + unset($this->object); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testAddDeleteProduct() |
39 | 39 | { |
40 | 40 | $basket = $this->object->get(); |
41 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
41 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
42 | 42 | |
43 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
44 | - $this->assertEquals( 2, $basket->getProduct( 0 )->getQuantity() ); |
|
45 | - $this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() ); |
|
43 | + $this->assertEquals(1, count($basket->getProducts())); |
|
44 | + $this->assertEquals(2, $basket->getProduct(0)->getQuantity()); |
|
45 | + $this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode()); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testAddProductNoSelection() |
50 | 50 | { |
51 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
51 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
52 | 52 | |
53 | - $this->object->addProduct( $item->getId(), 1 ); |
|
53 | + $this->object->addProduct($item->getId(), 1); |
|
54 | 54 | |
55 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
56 | - $this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
57 | - $this->assertEquals( 0, count( $this->object->get()->getProduct( 0 )->getProducts() ) ); |
|
55 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
56 | + $this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode()); |
|
57 | + $this->assertEquals(0, count($this->object->get()->getProduct(0)->getProducts())); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | public function testAddProductVariant() |
62 | 62 | { |
63 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
63 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
64 | 64 | |
65 | 65 | $search = $attributeManager->createSearch(); |
66 | - $search->setConditions( $search->compare( '==', 'attribute.code', array( 'xs', 'white' ) ) ); |
|
66 | + $search->setConditions($search->compare('==', 'attribute.code', array('xs', 'white'))); |
|
67 | 67 | |
68 | - $attributes = $attributeManager->searchItems( $search ); |
|
68 | + $attributes = $attributeManager->searchItems($search); |
|
69 | 69 | |
70 | - if( count( $attributes ) === 0 ) { |
|
71 | - throw new \RuntimeException( 'Attributes not found' ); |
|
70 | + if (count($attributes) === 0) { |
|
71 | + throw new \RuntimeException('Attributes not found'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
75 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
76 | 76 | |
77 | - $this->object->addProduct( $item->getId(), 1, [], array_keys( $attributes ), [], [], [], 'default' ); |
|
77 | + $this->object->addProduct($item->getId(), 1, [], array_keys($attributes), [], [], [], 'default'); |
|
78 | 78 | |
79 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
80 | - $this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
79 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
80 | + $this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode()); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | 84 | public function testAddProductVariantIncomplete() |
85 | 85 | { |
86 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
86 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
87 | 87 | |
88 | 88 | $search = $attributeManager->createSearch(); |
89 | 89 | $expr = array( |
90 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
91 | - $search->compare( '==', 'attribute.code', '30' ), |
|
92 | - $search->compare( '==', 'attribute.type.code', 'length' ), |
|
90 | + $search->compare('==', 'attribute.domain', 'product'), |
|
91 | + $search->compare('==', 'attribute.code', '30'), |
|
92 | + $search->compare('==', 'attribute.type.code', 'length'), |
|
93 | 93 | ); |
94 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
94 | + $search->setConditions($search->combine('&&', $expr)); |
|
95 | 95 | |
96 | - $attributes = $attributeManager->searchItems( $search ); |
|
96 | + $attributes = $attributeManager->searchItems($search); |
|
97 | 97 | |
98 | - if( count( $attributes ) === 0 ) { |
|
99 | - throw new \RuntimeException( 'Attributes not found' ); |
|
98 | + if (count($attributes) === 0) { |
|
99 | + throw new \RuntimeException('Attributes not found'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
103 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' ); |
|
103 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST'); |
|
104 | 104 | |
105 | - $this->object->addProduct( $item->getId(), 1, [], array_keys( $attributes ) ); |
|
105 | + $this->object->addProduct($item->getId(), 1, [], array_keys($attributes)); |
|
106 | 106 | |
107 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
108 | - $this->assertEquals( 'U:TESTSUB02', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
109 | - $this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getAttributes() ) ); |
|
107 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
108 | + $this->assertEquals('U:TESTSUB02', $this->object->get()->getProduct(0)->getProductCode()); |
|
109 | + $this->assertEquals(2, count($this->object->get()->getProduct(0)->getAttributes())); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
113 | 113 | public function testAddProductVariantNonUnique() |
114 | 114 | { |
115 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
115 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
116 | 116 | |
117 | 117 | $search = $attributeManager->createSearch(); |
118 | 118 | $expr = array( |
119 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
120 | - $search->compare( '==', 'attribute.code', '30' ), |
|
121 | - $search->compare( '==', 'attribute.type.code', 'width' ), |
|
119 | + $search->compare('==', 'attribute.domain', 'product'), |
|
120 | + $search->compare('==', 'attribute.code', '30'), |
|
121 | + $search->compare('==', 'attribute.type.code', 'width'), |
|
122 | 122 | ); |
123 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
123 | + $search->setConditions($search->combine('&&', $expr)); |
|
124 | 124 | |
125 | - $attributes = $attributeManager->searchItems( $search ); |
|
125 | + $attributes = $attributeManager->searchItems($search); |
|
126 | 126 | |
127 | - if( count( $attributes ) === 0 ) { |
|
128 | - throw new \RuntimeException( 'Attributes not found' ); |
|
127 | + if (count($attributes) === 0) { |
|
128 | + throw new \RuntimeException('Attributes not found'); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' ); |
|
132 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST'); |
|
133 | 133 | |
134 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
135 | - $this->object->addProduct( $item->getId(), 1, [], array_keys( $attributes ) ); |
|
134 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
135 | + $this->object->addProduct($item->getId(), 1, [], array_keys($attributes)); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
139 | 139 | public function testAddProductVariantNotRequired() |
140 | 140 | { |
141 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
141 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
142 | 142 | |
143 | 143 | $search = $attributeManager->createSearch(); |
144 | - $search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) ); |
|
144 | + $search->setConditions($search->compare('==', 'attribute.code', 'xs')); |
|
145 | 145 | |
146 | - $attributes = $attributeManager->searchItems( $search ); |
|
146 | + $attributes = $attributeManager->searchItems($search); |
|
147 | 147 | |
148 | - if( count( $attributes ) === 0 ) { |
|
149 | - throw new \RuntimeException( 'Attribute not found' ); |
|
148 | + if (count($attributes) === 0) { |
|
149 | + throw new \RuntimeException('Attribute not found'); |
|
150 | 150 | } |
151 | 151 | |
152 | - $options = array( 'variant' => false ); |
|
152 | + $options = array('variant' => false); |
|
153 | 153 | |
154 | - $this->object->addProduct( $this->testItem->getId(), 1, $options, array_keys( $attributes ) ); |
|
154 | + $this->object->addProduct($this->testItem->getId(), 1, $options, array_keys($attributes)); |
|
155 | 155 | |
156 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
157 | - $this->assertEquals( 'U:TESTP', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
156 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
157 | + $this->assertEquals('U:TESTP', $this->object->get()->getProduct(0)->getProductCode()); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | 161 | public function testAddProductEmptySelectionException() |
162 | 162 | { |
163 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:noSel' ); |
|
163 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:noSel'); |
|
164 | 164 | |
165 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
166 | - $this->object->addProduct( $item->getId(), 1 ); |
|
165 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
166 | + $this->object->addProduct($item->getId(), 1); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
170 | 170 | public function testAddProductSelectionWithPricelessItem() |
171 | 171 | { |
172 | - $this->object->addProduct( $this->testItem->getId(), 1 ); |
|
172 | + $this->object->addProduct($this->testItem->getId(), 1); |
|
173 | 173 | |
174 | - $this->assertEquals( 'U:TESTPSUB01', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
174 | + $this->assertEquals('U:TESTPSUB01', $this->object->get()->getProduct(0)->getProductCode()); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
178 | 178 | public function testAddProductConfigAttribute() |
179 | 179 | { |
180 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
180 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
181 | 181 | |
182 | 182 | $search = $attributeManager->createSearch(); |
183 | - $search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) ); |
|
183 | + $search->setConditions($search->compare('==', 'attribute.code', 'xs')); |
|
184 | 184 | |
185 | - $attributes = $attributeManager->searchItems( $search ); |
|
185 | + $attributes = $attributeManager->searchItems($search); |
|
186 | 186 | |
187 | - if( empty( $attributes ) ) { |
|
188 | - throw new \RuntimeException( 'Attribute not found' ); |
|
187 | + if (empty($attributes)) { |
|
188 | + throw new \RuntimeException('Attribute not found'); |
|
189 | 189 | } |
190 | 190 | |
191 | - $this->object->addProduct( $this->testItem->getId(), 1, [], [], array_keys( $attributes ) ); |
|
191 | + $this->object->addProduct($this->testItem->getId(), 1, [], [], array_keys($attributes)); |
|
192 | 192 | $basket = $this->object->get(); |
193 | 193 | |
194 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
195 | - $this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() ); |
|
196 | - $this->assertEquals( 'xs', $basket->getProduct( 0 )->getAttribute( 'size', 'config' ) ); |
|
194 | + $this->assertEquals(1, count($basket->getProducts())); |
|
195 | + $this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode()); |
|
196 | + $this->assertEquals('xs', $basket->getProduct(0)->getAttribute('size', 'config')); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
200 | 200 | public function testAddProductHiddenAttribute() |
201 | 201 | { |
202 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
202 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
203 | 203 | |
204 | 204 | $search = $attributeManager->createSearch(); |
205 | 205 | $expr = array( |
206 | - $search->compare( '==', 'attribute.code', '29' ), |
|
207 | - $search->compare( '==', 'attribute.type.code', 'width' ), |
|
206 | + $search->compare('==', 'attribute.code', '29'), |
|
207 | + $search->compare('==', 'attribute.type.code', 'width'), |
|
208 | 208 | ); |
209 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
209 | + $search->setConditions($search->combine('&&', $expr)); |
|
210 | 210 | |
211 | - $attributes = $attributeManager->searchItems( $search ); |
|
211 | + $attributes = $attributeManager->searchItems($search); |
|
212 | 212 | |
213 | - if( empty( $attributes ) ) { |
|
214 | - throw new \RuntimeException( 'Attribute not found' ); |
|
213 | + if (empty($attributes)) { |
|
214 | + throw new \RuntimeException('Attribute not found'); |
|
215 | 215 | } |
216 | 216 | |
217 | - $this->object->addProduct( $this->testItem->getId(), 1, [], [], [], array_keys( $attributes ) ); |
|
217 | + $this->object->addProduct($this->testItem->getId(), 1, [], [], [], array_keys($attributes)); |
|
218 | 218 | |
219 | 219 | $basket = $this->object->get(); |
220 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
220 | + $this->assertEquals(1, count($basket->getProducts())); |
|
221 | 221 | |
222 | - $product = $basket->getProduct( 0 ); |
|
223 | - $this->assertEquals( 'U:TESTPSUB01', $product->getProductCode() ); |
|
222 | + $product = $basket->getProduct(0); |
|
223 | + $this->assertEquals('U:TESTPSUB01', $product->getProductCode()); |
|
224 | 224 | |
225 | 225 | $attributes = $product->getAttributes(); |
226 | - $this->assertEquals( 1, count( $attributes ) ); |
|
226 | + $this->assertEquals(1, count($attributes)); |
|
227 | 227 | |
228 | - if( ( $attribute = reset( $attributes ) ) === false ) { |
|
229 | - throw new \RuntimeException( 'No attribute' ); |
|
228 | + if (($attribute = reset($attributes)) === false) { |
|
229 | + throw new \RuntimeException('No attribute'); |
|
230 | 230 | } |
231 | 231 | |
232 | - $this->assertEquals( 'hidden', $attribute->getType() ); |
|
233 | - $this->assertEquals( '29', $product->getAttribute( 'width', 'hidden' ) ); |
|
232 | + $this->assertEquals('hidden', $attribute->getType()); |
|
233 | + $this->assertEquals('29', $product->getAttribute('width', 'hidden')); |
|
234 | 234 | } |
235 | 235 | } |
@@ -21,46 +21,46 @@ discard block |
||
21 | 21 | |
22 | 22 | protected function tearDown() |
23 | 23 | { |
24 | - $this->context->getSession()->set( 'aimeos', [] ); |
|
24 | + $this->context->getSession()->set('aimeos', []); |
|
25 | 25 | |
26 | - unset( $this->context ); |
|
26 | + unset($this->context); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | public function testCheckLocale() |
31 | 31 | { |
32 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' ) |
|
33 | - ->setConstructorArgs( [$this->context] ) |
|
34 | - ->setMethods( null ) |
|
32 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
33 | + ->setConstructorArgs([$this->context]) |
|
34 | + ->setMethods(null) |
|
35 | 35 | ->getMock(); |
36 | 36 | |
37 | - $this->context->getSession()->set( 'aimeos/basket/locale', 'unittest|en|EUR' ); |
|
38 | - $this->access( 'checkLocale' )->invokeArgs( $object, ['unittest'] ); |
|
37 | + $this->context->getSession()->set('aimeos/basket/locale', 'unittest|en|EUR'); |
|
38 | + $this->access('checkLocale')->invokeArgs($object, ['unittest']); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | 42 | public function testCopyAddresses() |
43 | 43 | { |
44 | - $manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' ); |
|
44 | + $manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base'); |
|
45 | 45 | $ordBaseItem = $manager->createItem(); |
46 | 46 | |
47 | - $address = $this->getAddress( 'Example company' ); |
|
48 | - $ordBaseItem->setAddress( $address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
47 | + $address = $this->getAddress('Example company'); |
|
48 | + $ordBaseItem->setAddress($address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
49 | 49 | |
50 | 50 | |
51 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' ) |
|
52 | - ->setConstructorArgs( [$this->context] ) |
|
53 | - ->setMethods( null ) |
|
51 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
52 | + ->setConstructorArgs([$this->context]) |
|
53 | + ->setMethods(null) |
|
54 | 54 | ->getMock(); |
55 | 55 | |
56 | - $result = $this->access( 'copyAddresses' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] ); |
|
56 | + $result = $this->access('copyAddresses')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']); |
|
57 | 57 | |
58 | 58 | |
59 | - $this->assertEquals( ['test'], $result ); |
|
60 | - $this->assertEquals( 1, count( $object->get()->getAddresses() ) ); |
|
59 | + $this->assertEquals(['test'], $result); |
|
60 | + $this->assertEquals(1, count($object->get()->getAddresses())); |
|
61 | 61 | |
62 | - $addr = $object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
63 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Address\Iface', $addr ); |
|
62 | + $addr = $object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
63 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Address\Iface', $addr); |
|
64 | 64 | |
65 | 65 | $object->clear(); |
66 | 66 | } |
@@ -68,54 +68,54 @@ discard block |
||
68 | 68 | |
69 | 69 | public function testCopyAddressesException() |
70 | 70 | { |
71 | - $manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' ); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base'); |
|
72 | 72 | $ordBaseItem = $manager->createItem(); |
73 | 73 | |
74 | - $address = $this->getAddress( 'Example company' ); |
|
75 | - $ordBaseItem->setAddress( $address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
74 | + $address = $this->getAddress('Example company'); |
|
75 | + $ordBaseItem->setAddress($address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
76 | 76 | |
77 | 77 | |
78 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' ) |
|
79 | - ->setConstructorArgs( [$this->context] ) |
|
80 | - ->setMethods( ['setAddress'] ) |
|
78 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
79 | + ->setConstructorArgs([$this->context]) |
|
80 | + ->setMethods(['setAddress']) |
|
81 | 81 | ->getMock(); |
82 | 82 | |
83 | - $object->expects( $this->once() )->method( 'setAddress' )->will( $this->throwException( new \Exception() ) ); |
|
83 | + $object->expects($this->once())->method('setAddress')->will($this->throwException(new \Exception())); |
|
84 | 84 | |
85 | - $result = $this->access( 'copyAddresses' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] ); |
|
85 | + $result = $this->access('copyAddresses')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']); |
|
86 | 86 | |
87 | - $this->assertEquals( 1, count( $result ) ); |
|
88 | - $this->assertArrayHasKey( 'address', $result ); |
|
87 | + $this->assertEquals(1, count($result)); |
|
88 | + $this->assertArrayHasKey('address', $result); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
92 | 92 | public function testCopyCoupon() |
93 | 93 | { |
94 | - $manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' ); |
|
94 | + $manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base'); |
|
95 | 95 | $ordBaseItem = $manager->createItem(); |
96 | 96 | |
97 | - $product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC', ['price'] ); |
|
98 | - $ordProdManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' ); |
|
99 | - $ordProdItem = $ordProdManager->createItem()->copyFrom( $product ); |
|
97 | + $product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC', ['price']); |
|
98 | + $ordProdManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product'); |
|
99 | + $ordProdItem = $ordProdManager->createItem()->copyFrom($product); |
|
100 | 100 | |
101 | - $priceItems = $product->getRefItems( 'price' ); |
|
102 | - $ordProdItem->setPrice( reset( $priceItems ) ); |
|
101 | + $priceItems = $product->getRefItems('price'); |
|
102 | + $ordProdItem->setPrice(reset($priceItems)); |
|
103 | 103 | |
104 | - $ordBaseItem->addProduct( $ordProdItem ); |
|
105 | - $ordBaseItem->addCoupon( 'OPQR', [] ); |
|
104 | + $ordBaseItem->addProduct($ordProdItem); |
|
105 | + $ordBaseItem->addCoupon('OPQR', []); |
|
106 | 106 | |
107 | 107 | |
108 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' ) |
|
109 | - ->setConstructorArgs( [$this->context] ) |
|
110 | - ->setMethods( null ) |
|
108 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
109 | + ->setConstructorArgs([$this->context]) |
|
110 | + ->setMethods(null) |
|
111 | 111 | ->getMock(); |
112 | 112 | |
113 | - $object->addProduct( $product->getId() ); |
|
113 | + $object->addProduct($product->getId()); |
|
114 | 114 | |
115 | - $result = $this->access( 'copyCoupons' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] ); |
|
115 | + $result = $this->access('copyCoupons')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']); |
|
116 | 116 | |
117 | 117 | |
118 | - $this->assertEquals( ['test'], $result ); |
|
118 | + $this->assertEquals(['test'], $result); |
|
119 | 119 | |
120 | 120 | $object->clear(); |
121 | 121 | } |
@@ -123,48 +123,48 @@ discard block |
||
123 | 123 | |
124 | 124 | public function testCopyCouponException() |
125 | 125 | { |
126 | - $manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' ); |
|
126 | + $manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base'); |
|
127 | 127 | $ordBaseItem = $manager->createItem(); |
128 | 128 | |
129 | - $ordBaseItem->addCoupon( '90AB', [] ); |
|
129 | + $ordBaseItem->addCoupon('90AB', []); |
|
130 | 130 | |
131 | 131 | |
132 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' ) |
|
133 | - ->setConstructorArgs( [$this->context] ) |
|
134 | - ->setMethods( ['addCoupon'] ) |
|
132 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
133 | + ->setConstructorArgs([$this->context]) |
|
134 | + ->setMethods(['addCoupon']) |
|
135 | 135 | ->getMock(); |
136 | 136 | |
137 | - $object->expects( $this->once() )->method( 'addCoupon' )->will( $this->throwException( new \Exception() ) ); |
|
137 | + $object->expects($this->once())->method('addCoupon')->will($this->throwException(new \Exception())); |
|
138 | 138 | |
139 | - $result = $this->access( 'copyCoupons' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] ); |
|
139 | + $result = $this->access('copyCoupons')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']); |
|
140 | 140 | |
141 | - $this->assertEquals( 1, count( $result ) ); |
|
142 | - $this->assertArrayHasKey( 'coupon', $result ); |
|
141 | + $this->assertEquals(1, count($result)); |
|
142 | + $this->assertArrayHasKey('coupon', $result); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
146 | 146 | public function testCopyProduct() |
147 | 147 | { |
148 | - $manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' ); |
|
148 | + $manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base'); |
|
149 | 149 | $ordBaseItem = $manager->createItem(); |
150 | 150 | |
151 | - $product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
152 | - $ordProdManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' ); |
|
153 | - $ordProdItem = $ordProdManager->createItem()->copyFrom( $product ); |
|
154 | - $ordBaseItem->addProduct( $ordProdItem ); |
|
151 | + $product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
152 | + $ordProdManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product'); |
|
153 | + $ordProdItem = $ordProdManager->createItem()->copyFrom($product); |
|
154 | + $ordBaseItem->addProduct($ordProdItem); |
|
155 | 155 | |
156 | 156 | |
157 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' ) |
|
158 | - ->setConstructorArgs( [$this->context] ) |
|
159 | - ->setMethods( null ) |
|
157 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
158 | + ->setConstructorArgs([$this->context]) |
|
159 | + ->setMethods(null) |
|
160 | 160 | ->getMock(); |
161 | 161 | |
162 | - $result = $this->access( 'copyProducts' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] ); |
|
162 | + $result = $this->access('copyProducts')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']); |
|
163 | 163 | |
164 | 164 | |
165 | - $this->assertEquals( ['test'], $result ); |
|
166 | - $this->assertEquals( 1, count( $object->get()->getProducts() ) ); |
|
167 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Product\Iface', $object->get()->getProduct( 0 ) ); |
|
165 | + $this->assertEquals(['test'], $result); |
|
166 | + $this->assertEquals(1, count($object->get()->getProducts())); |
|
167 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Product\Iface', $object->get()->getProduct(0)); |
|
168 | 168 | |
169 | 169 | $object->clear(); |
170 | 170 | } |
@@ -172,56 +172,56 @@ discard block |
||
172 | 172 | |
173 | 173 | public function testCopyProductException() |
174 | 174 | { |
175 | - $manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' ); |
|
175 | + $manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base'); |
|
176 | 176 | $ordBaseItem = $manager->createItem(); |
177 | 177 | |
178 | - $product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
179 | - $ordProdManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' ); |
|
180 | - $ordProdItem = $ordProdManager->createItem()->copyFrom( $product ); |
|
181 | - $ordBaseItem->addProduct( $ordProdItem ); |
|
178 | + $product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
179 | + $ordProdManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product'); |
|
180 | + $ordProdItem = $ordProdManager->createItem()->copyFrom($product); |
|
181 | + $ordBaseItem->addProduct($ordProdItem); |
|
182 | 182 | |
183 | 183 | |
184 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' ) |
|
185 | - ->setConstructorArgs( [$this->context] ) |
|
186 | - ->setMethods( ['addProduct'] ) |
|
184 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
185 | + ->setConstructorArgs([$this->context]) |
|
186 | + ->setMethods(['addProduct']) |
|
187 | 187 | ->getMock(); |
188 | 188 | |
189 | - $object->expects( $this->once() )->method( 'addProduct' )->will( $this->throwException( new \Exception() ) ); |
|
189 | + $object->expects($this->once())->method('addProduct')->will($this->throwException(new \Exception())); |
|
190 | 190 | |
191 | - $result = $this->access( 'copyProducts' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] ); |
|
191 | + $result = $this->access('copyProducts')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']); |
|
192 | 192 | |
193 | - $this->assertEquals( 1, count( $result ) ); |
|
194 | - $this->assertArrayHasKey( 'product', $result ); |
|
193 | + $this->assertEquals(1, count($result)); |
|
194 | + $this->assertArrayHasKey('product', $result); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
198 | 198 | public function testCopyServices() |
199 | 199 | { |
200 | - $manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' ); |
|
200 | + $manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base'); |
|
201 | 201 | $ordBaseItem = $manager->createItem(); |
202 | 202 | |
203 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' ); |
|
204 | - $ordServManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/service' ); |
|
203 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->context, 'service'); |
|
204 | + $ordServManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/service'); |
|
205 | 205 | |
206 | - $serviceItem = $serviceManager->findItem( 'unitcode', [], 'service', 'delivery' ); |
|
207 | - $ordServItem = $ordServManager->createItem()->copyFrom( $serviceItem ); |
|
206 | + $serviceItem = $serviceManager->findItem('unitcode', [], 'service', 'delivery'); |
|
207 | + $ordServItem = $ordServManager->createItem()->copyFrom($serviceItem); |
|
208 | 208 | |
209 | - $ordBaseItem->setService( $ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY ); |
|
209 | + $ordBaseItem->setService($ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY); |
|
210 | 210 | |
211 | 211 | |
212 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' ) |
|
213 | - ->setConstructorArgs( [$this->context] ) |
|
214 | - ->setMethods( null ) |
|
212 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
213 | + ->setConstructorArgs([$this->context]) |
|
214 | + ->setMethods(null) |
|
215 | 215 | ->getMock(); |
216 | 216 | |
217 | - $result = $this->access( 'copyServices' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] ); |
|
217 | + $result = $this->access('copyServices')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']); |
|
218 | 218 | |
219 | 219 | |
220 | - $this->assertEquals( ['test'], $result ); |
|
221 | - $this->assertEquals( 1, count( $object->get()->getServices() ) ); |
|
220 | + $this->assertEquals(['test'], $result); |
|
221 | + $this->assertEquals(1, count($object->get()->getServices())); |
|
222 | 222 | |
223 | - $service = $object->get()->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY ); |
|
224 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Service\Iface', $service ); |
|
223 | + $service = $object->get()->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY); |
|
224 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Service\Iface', $service); |
|
225 | 225 | |
226 | 226 | $object->clear(); |
227 | 227 | } |
@@ -229,58 +229,58 @@ discard block |
||
229 | 229 | |
230 | 230 | public function testCopyServicesException() |
231 | 231 | { |
232 | - $manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' ); |
|
232 | + $manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base'); |
|
233 | 233 | $ordBaseItem = $manager->createItem(); |
234 | 234 | |
235 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' ); |
|
236 | - $ordServManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/service' ); |
|
235 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->context, 'service'); |
|
236 | + $ordServManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/service'); |
|
237 | 237 | |
238 | - $serviceItem = $serviceManager->findItem( 'unitcode', [], 'service', 'delivery' ); |
|
239 | - $ordServItem = $ordServManager->createItem()->copyFrom( $serviceItem ); |
|
238 | + $serviceItem = $serviceManager->findItem('unitcode', [], 'service', 'delivery'); |
|
239 | + $ordServItem = $ordServManager->createItem()->copyFrom($serviceItem); |
|
240 | 240 | |
241 | - $ordBaseItem->setService( $ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY ); |
|
241 | + $ordBaseItem->setService($ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY); |
|
242 | 242 | |
243 | 243 | |
244 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' ) |
|
245 | - ->setConstructorArgs( [$this->context] ) |
|
246 | - ->setMethods( ['setService'] ) |
|
244 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
245 | + ->setConstructorArgs([$this->context]) |
|
246 | + ->setMethods(['setService']) |
|
247 | 247 | ->getMock(); |
248 | 248 | |
249 | - $object->expects( $this->once() )->method( 'setService' )->will( $this->throwException( new \Exception() ) ); |
|
249 | + $object->expects($this->once())->method('setService')->will($this->throwException(new \Exception())); |
|
250 | 250 | |
251 | - $result = $this->access( 'copyServices' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] ); |
|
251 | + $result = $this->access('copyServices')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']); |
|
252 | 252 | |
253 | - $this->assertEquals( 0, count( $result ) ); |
|
253 | + $this->assertEquals(0, count($result)); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | |
257 | 257 | /** |
258 | 258 | * @param string $company |
259 | 259 | */ |
260 | - protected function getAddress( $company ) |
|
260 | + protected function getAddress($company) |
|
261 | 261 | { |
262 | - $manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'customer/address' ); |
|
262 | + $manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'customer/address'); |
|
263 | 263 | |
264 | 264 | $search = $manager->createSearch(); |
265 | - $search->setConditions( $search->compare( '==', 'customer.address.company', $company ) ); |
|
266 | - $items = $manager->searchItems( $search ); |
|
265 | + $search->setConditions($search->compare('==', 'customer.address.company', $company)); |
|
266 | + $items = $manager->searchItems($search); |
|
267 | 267 | |
268 | - if( ( $item = reset( $items ) ) === false ) { |
|
269 | - throw new \RuntimeException( sprintf( 'No address item with company "%1$s" found', $company ) ); |
|
268 | + if (($item = reset($items)) === false) { |
|
269 | + throw new \RuntimeException(sprintf('No address item with company "%1$s" found', $company)); |
|
270 | 270 | } |
271 | 271 | |
272 | - $ordAddrManager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base/address' ); |
|
273 | - $ordAddrItem = $ordAddrManager->createItem()->copyFrom( $item ); |
|
272 | + $ordAddrManager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base/address'); |
|
273 | + $ordAddrItem = $ordAddrManager->createItem()->copyFrom($item); |
|
274 | 274 | |
275 | 275 | return $ordAddrItem; |
276 | 276 | } |
277 | 277 | |
278 | 278 | |
279 | - protected function access( $name ) |
|
279 | + protected function access($name) |
|
280 | 280 | { |
281 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Basket\Base' ); |
|
282 | - $method = $class->getMethod( $name ); |
|
283 | - $method->setAccessible( true ); |
|
281 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Basket\Base'); |
|
282 | + $method = $class->getMethod($name); |
|
283 | + $method->setAccessible(true); |
|
284 | 284 | |
285 | 285 | return $method; |
286 | 286 | } |