@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
36 | 36 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
37 | 37 | */ |
38 | - public function checkAttributes( $serviceId, array $attributes ) |
|
38 | + public function checkAttributes($serviceId, array $attributes) |
|
39 | 39 | { |
40 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
40 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
41 | 41 | |
42 | - $item = $manager->getItem( $serviceId, [], true ); |
|
43 | - $provider = $manager->getProvider( $item, $item->getType() ); |
|
42 | + $item = $manager->getItem($serviceId, [], true); |
|
43 | + $provider = $manager->getProvider($item, $item->getType()); |
|
44 | 44 | |
45 | - return array_filter( $provider->checkConfigFE( $attributes ) ); |
|
45 | + return array_filter($provider->checkConfigFE($attributes)); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | * @param string[] $ref List of domain names whose items should be fetched too |
54 | 54 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
55 | 55 | */ |
56 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
56 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
57 | 57 | { |
58 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
59 | - $item = $manager->getItem( $serviceId, $ref, true ); |
|
58 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
59 | + $item = $manager->getItem($serviceId, $ref, true); |
|
60 | 60 | |
61 | - return $manager->getProvider( $item, $item->getType() ); |
|
61 | + return $manager->getProvider($item, $item->getType()); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -69,26 +69,26 @@ discard block |
||
69 | 69 | * @param string[] $ref List of domain names whose items should be fetched too |
70 | 70 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
71 | 71 | */ |
72 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ) |
|
72 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']) |
|
73 | 73 | { |
74 | 74 | $list = []; |
75 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
75 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
76 | 76 | |
77 | - $search = $manager->createSearch( true ); |
|
78 | - $search->setSortations( [$search->sort( '+', 'service.type.position' ), $search->sort( '+', 'service.position' )] ); |
|
77 | + $search = $manager->createSearch(true); |
|
78 | + $search->setSortations([$search->sort('+', 'service.type.position'), $search->sort('+', 'service.position')]); |
|
79 | 79 | |
80 | - if( $type != null ) |
|
80 | + if ($type != null) |
|
81 | 81 | { |
82 | 82 | $expr = array( |
83 | 83 | $search->getConditions(), |
84 | - $search->compare( '==', 'service.type.code', $type ), |
|
85 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
84 | + $search->compare('==', 'service.type.code', $type), |
|
85 | + $search->compare('==', 'service.type.domain', 'service'), |
|
86 | 86 | ); |
87 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
87 | + $search->setConditions($search->combine('&&', $expr)); |
|
88 | 88 | } |
89 | 89 | |
90 | - foreach( $manager->searchItems( $search, $ref ) as $id => $item ) { |
|
91 | - $list[$id] = $manager->getProvider( $item, $item->getType() ); |
|
90 | + foreach ($manager->searchItems($search, $ref) as $id => $item) { |
|
91 | + $list[$id] = $manager->getProvider($item, $item->getType()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return $list; |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc. |
107 | 107 | * or null if no form data is required |
108 | 108 | */ |
109 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ) |
|
109 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params) |
|
110 | 110 | { |
111 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
112 | - $item = $manager->getItem( $serviceId, [], true ); |
|
111 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
112 | + $item = $manager->getItem($serviceId, [], true); |
|
113 | 113 | |
114 | - $provider = $manager->getProvider( $item, $item->getType() ); |
|
115 | - $provider->injectGlobalConfigBE( $urls ); |
|
114 | + $provider = $manager->getProvider($item, $item->getType()); |
|
115 | + $provider->injectGlobalConfigBE($urls); |
|
116 | 116 | |
117 | - return $provider->process( $orderItem, $params ); |
|
117 | + return $provider->process($orderItem, $params); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | * @param string $code Unique code of the service used for the current order |
127 | 127 | * @return \Psr\Http\Message\ResponseInterface Response object |
128 | 128 | */ |
129 | - public function updatePush( ServerRequestInterface $request, ResponseInterface $response, $code ) |
|
129 | + public function updatePush(ServerRequestInterface $request, ResponseInterface $response, $code) |
|
130 | 130 | { |
131 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
132 | - $item = $manager->findItem( $code ); |
|
131 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
132 | + $item = $manager->findItem($code); |
|
133 | 133 | |
134 | - $provider = $manager->getProvider( $item, $item->getType() ); |
|
134 | + $provider = $manager->getProvider($item, $item->getType()); |
|
135 | 135 | |
136 | - return $provider->updatePush( $request, $response ); |
|
136 | + return $provider->updatePush($request, $response); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -145,24 +145,24 @@ discard block |
||
145 | 145 | * @param string $orderid ID of the order whose payment status should be updated |
146 | 146 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
147 | 147 | */ |
148 | - public function updateSync( ServerRequestInterface $request, $code, $orderid ) |
|
148 | + public function updateSync(ServerRequestInterface $request, $code, $orderid) |
|
149 | 149 | { |
150 | 150 | $context = $this->getContext(); |
151 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
152 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
151 | + $orderManager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
152 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
153 | 153 | |
154 | - $orderItem = $orderManager->getItem( $orderid ); |
|
155 | - $serviceItem = $serviceManager->findItem( $code ); |
|
154 | + $orderItem = $orderManager->getItem($orderid); |
|
155 | + $serviceItem = $serviceManager->findItem($code); |
|
156 | 156 | |
157 | - $provider = $serviceManager->getProvider( $serviceItem, $serviceItem->getType() ); |
|
157 | + $provider = $serviceManager->getProvider($serviceItem, $serviceItem->getType()); |
|
158 | 158 | |
159 | 159 | |
160 | - if( ( $orderItem = $provider->updateSync( $request, $orderItem ) ) !== null ) |
|
160 | + if (($orderItem = $provider->updateSync($request, $orderItem)) !== null) |
|
161 | 161 | { |
162 | - if( $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
163 | - && $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY ) |
|
162 | + if ($orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
163 | + && $provider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY) |
|
164 | 164 | ) { |
165 | - $provider->query( $orderItem ); |
|
165 | + $provider->query($orderItem); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
30 | 30 | * @since 2017.03 |
31 | 31 | */ |
32 | - public function addFilterTypes( \Aimeos\MW\Criteria\Iface $filter, array $codes ) |
|
32 | + public function addFilterTypes(\Aimeos\MW\Criteria\Iface $filter, array $codes) |
|
33 | 33 | { |
34 | - if( !empty( $codes ) ) |
|
34 | + if (!empty($codes)) |
|
35 | 35 | { |
36 | 36 | $expr = [ |
37 | - $filter->compare( '==', 'attribute.type.code', $codes ), |
|
37 | + $filter->compare('==', 'attribute.type.code', $codes), |
|
38 | 38 | $filter->getConditions(), |
39 | 39 | ]; |
40 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
40 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return $filter; |
@@ -53,15 +53,15 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function createFilter() |
55 | 55 | { |
56 | - $filter = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->createSearch( true ); |
|
56 | + $filter = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->createSearch(true); |
|
57 | 57 | |
58 | 58 | $expr = array( |
59 | - $filter->compare( '==', 'attribute.domain', 'product' ), |
|
59 | + $filter->compare('==', 'attribute.domain', 'product'), |
|
60 | 60 | $filter->getConditions(), |
61 | 61 | ); |
62 | 62 | |
63 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
64 | - $filter->setSortations( [$filter->sort( '+', 'attribute.type.position' ), $filter->sort( '+', 'attribute.position' )] ); |
|
63 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
64 | + $filter->setSortations([$filter->sort('+', 'attribute.type.position'), $filter->sort('+', 'attribute.position')]); |
|
65 | 65 | |
66 | 66 | return $filter; |
67 | 67 | } |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | * @return \Aimeos\MShop\Attribute\Item\Iface Attribute item including the referenced domains items |
76 | 76 | * @since 2017.03 |
77 | 77 | */ |
78 | - public function getItem( $id, array $domains = array( 'media', 'price', 'text' ) ) |
|
78 | + public function getItem($id, array $domains = array('media', 'price', 'text')) |
|
79 | 79 | { |
80 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->getItem( $id, $domains, true ); |
|
80 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->getItem($id, $domains, true); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute item including the referenced domains items |
90 | 90 | * @since 2017.03 |
91 | 91 | */ |
92 | - public function getItems( array $ids, array $domains = array( 'media', 'price', 'text' ) ) |
|
92 | + public function getItems(array $ids, array $domains = array('media', 'price', 'text')) |
|
93 | 93 | { |
94 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' ); |
|
94 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute'); |
|
95 | 95 | |
96 | - $filter = $manager->createSearch( true ); |
|
96 | + $filter = $manager->createSearch(true); |
|
97 | 97 | $expr = [ |
98 | - $filter->compare( '==', 'attribute.domain', 'product' ), |
|
99 | - $filter->compare( '==', 'attribute.id', $ids ), |
|
98 | + $filter->compare('==', 'attribute.domain', 'product'), |
|
99 | + $filter->compare('==', 'attribute.id', $ids), |
|
100 | 100 | $filter->getConditions(), |
101 | 101 | ]; |
102 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
103 | - $filter->setSortations( [$filter->sort( '+', 'attribute.type.position' ), $filter->sort( '+', 'attribute.position' )] ); |
|
102 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
103 | + $filter->setSortations([$filter->sort('+', 'attribute.type.position'), $filter->sort('+', 'attribute.position')]); |
|
104 | 104 | |
105 | - return $manager->searchItems( $filter, $domains ); |
|
105 | + return $manager->searchItems($filter, $domains); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * @return array Ordered list of attribute items implementing \Aimeos\MShop\Attribute\Item\Iface |
116 | 116 | * @since 2017.03 |
117 | 117 | */ |
118 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
118 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
119 | 119 | { |
120 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->searchItems( $filter, $domains, $total ); |
|
120 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->searchItems($filter, $domains, $total); |
|
121 | 121 | } |
122 | 122 | } |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - $this->object = new \Aimeos\Controller\Frontend\Stock\Standard( \TestHelperFrontend::getContext() ); |
|
19 | + $this->object = new \Aimeos\Controller\Frontend\Stock\Standard(\TestHelperFrontend::getContext()); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | 23 | protected function tearDown() |
24 | 24 | { |
25 | - unset( $this->object ); |
|
25 | + unset($this->object); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -30,66 +30,66 @@ discard block |
||
30 | 30 | { |
31 | 31 | $filter = $this->object->createFilter(); |
32 | 32 | |
33 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
34 | - $this->assertEquals( 1, count( $filter->getSortations() ) ); |
|
35 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
36 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
33 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
34 | + $this->assertEquals(1, count($filter->getSortations())); |
|
35 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
36 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | 40 | public function testAddFilterCodes() |
41 | 41 | { |
42 | 42 | $filter = $this->object->createFilter(); |
43 | - $filter = $this->object->addFilterCodes( $filter, ['CNC', 'CNE'] ); |
|
43 | + $filter = $this->object->addFilterCodes($filter, ['CNC', 'CNE']); |
|
44 | 44 | |
45 | 45 | $list = $filter->getConditions()->getExpressions(); |
46 | 46 | |
47 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
48 | - throw new \RuntimeException( 'Wrong expression' ); |
|
47 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
48 | + throw new \RuntimeException('Wrong expression'); |
|
49 | 49 | } |
50 | 50 | |
51 | - $this->assertEquals( 'stock.productcode', $list[0]->getName() ); |
|
52 | - $this->assertEquals( 2, count( $list[0]->getValue() ) ); |
|
51 | + $this->assertEquals('stock.productcode', $list[0]->getName()); |
|
52 | + $this->assertEquals(2, count($list[0]->getValue())); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | public function testAddFilterTypes() |
57 | 57 | { |
58 | 58 | $filter = $this->object->createFilter(); |
59 | - $filter = $this->object->addFilterTypes( $filter, ['default'] ); |
|
59 | + $filter = $this->object->addFilterTypes($filter, ['default']); |
|
60 | 60 | |
61 | 61 | $list = $filter->getConditions()->getExpressions(); |
62 | 62 | |
63 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
64 | - throw new \RuntimeException( 'Wrong expression' ); |
|
63 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
64 | + throw new \RuntimeException('Wrong expression'); |
|
65 | 65 | } |
66 | 66 | |
67 | - $this->assertEquals( 'stock.type.code', $list[0]->getName() ); |
|
68 | - $this->assertEquals( 1, count( $list[0]->getValue() ) ); |
|
67 | + $this->assertEquals('stock.type.code', $list[0]->getName()); |
|
68 | + $this->assertEquals(1, count($list[0]->getValue())); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | 72 | public function testGetItem() |
73 | 73 | { |
74 | 74 | $context = \TestHelperFrontend::getContext(); |
75 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'stock' ); |
|
76 | - $id = $manager->findItem( 'CNC', [], 'product', 'default' )->getId(); |
|
75 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'stock'); |
|
76 | + $id = $manager->findItem('CNC', [], 'product', 'default')->getId(); |
|
77 | 77 | |
78 | - $result = $this->object->getItem( $id ); |
|
78 | + $result = $this->object->getItem($id); |
|
79 | 79 | |
80 | - $this->assertInstanceOf( '\Aimeos\MShop\Stock\Item\Iface', $result ); |
|
80 | + $this->assertInstanceOf('\Aimeos\MShop\Stock\Item\Iface', $result); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | 84 | public function testSearchItems() |
85 | 85 | { |
86 | 86 | $filter = $this->object->createFilter(); |
87 | - $filter = $this->object->addFilterCodes( $filter, ['CNC', 'CNE'] ); |
|
87 | + $filter = $this->object->addFilterCodes($filter, ['CNC', 'CNE']); |
|
88 | 88 | |
89 | 89 | $total = 0; |
90 | - $results = $this->object->searchItems( $filter, $total ); |
|
90 | + $results = $this->object->searchItems($filter, $total); |
|
91 | 91 | |
92 | - $this->assertEquals( 2, $total ); |
|
93 | - $this->assertEquals( 2, count( $results ) ); |
|
92 | + $this->assertEquals(2, $total); |
|
93 | + $this->assertEquals(2, count($results)); |
|
94 | 94 | } |
95 | 95 | } |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - $this->object = new \Aimeos\Controller\Frontend\Attribute\Standard( \TestHelperFrontend::getContext() ); |
|
19 | + $this->object = new \Aimeos\Controller\Frontend\Attribute\Standard(\TestHelperFrontend::getContext()); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | 23 | protected function tearDown() |
24 | 24 | { |
25 | - unset( $this->object ); |
|
25 | + unset($this->object); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -30,57 +30,57 @@ discard block |
||
30 | 30 | { |
31 | 31 | $filter = $this->object->createFilter(); |
32 | 32 | |
33 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
34 | - $this->assertEquals( 2, count( $filter->getSortations() ) ); |
|
35 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
36 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
33 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
34 | + $this->assertEquals(2, count($filter->getSortations())); |
|
35 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
36 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | 40 | public function testAddFilterTypes() |
41 | 41 | { |
42 | 42 | $filter = $this->object->createFilter(); |
43 | - $filter = $this->object->addFilterTypes( $filter, ['size'] ); |
|
43 | + $filter = $this->object->addFilterTypes($filter, ['size']); |
|
44 | 44 | |
45 | 45 | $list = $filter->getConditions()->getExpressions(); |
46 | 46 | |
47 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
48 | - throw new \RuntimeException( 'Wrong expression' ); |
|
47 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
48 | + throw new \RuntimeException('Wrong expression'); |
|
49 | 49 | } |
50 | 50 | |
51 | - $this->assertEquals( 'attribute.type.code', $list[0]->getName() ); |
|
52 | - $this->assertEquals( 1, count( $list[0]->getValue() ) ); |
|
51 | + $this->assertEquals('attribute.type.code', $list[0]->getName()); |
|
52 | + $this->assertEquals(1, count($list[0]->getValue())); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | public function testGetItem() |
57 | 57 | { |
58 | 58 | $context = \TestHelperFrontend::getContext(); |
59 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
60 | - $id = $manager->findItem( 'xs', [], 'product', 'size' )->getId(); |
|
59 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
60 | + $id = $manager->findItem('xs', [], 'product', 'size')->getId(); |
|
61 | 61 | |
62 | - $result = $this->object->getItem( $id, ['text'] ); |
|
62 | + $result = $this->object->getItem($id, ['text']); |
|
63 | 63 | |
64 | - $this->assertInstanceOf( '\Aimeos\MShop\Attribute\Item\Iface', $result ); |
|
65 | - $this->assertEquals( 3, count( $result->getRefItems( 'text' ) ) ); |
|
64 | + $this->assertInstanceOf('\Aimeos\MShop\Attribute\Item\Iface', $result); |
|
65 | + $this->assertEquals(3, count($result->getRefItems('text'))); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testGetItems() |
70 | 70 | { |
71 | 71 | $context = \TestHelperFrontend::getContext(); |
72 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
73 | - $id = $manager->findItem( 'xs', [], 'product', 'size' )->getId(); |
|
72 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
73 | + $id = $manager->findItem('xs', [], 'product', 'size')->getId(); |
|
74 | 74 | |
75 | - $result = $this->object->getItems( [$id], ['text'] ); |
|
75 | + $result = $this->object->getItems([$id], ['text']); |
|
76 | 76 | |
77 | - $this->assertInternalType( 'array', $result ); |
|
78 | - $this->assertEquals( 1, count( $result ) ); |
|
77 | + $this->assertInternalType('array', $result); |
|
78 | + $this->assertEquals(1, count($result)); |
|
79 | 79 | |
80 | - foreach( $result as $attrItem ) |
|
80 | + foreach ($result as $attrItem) |
|
81 | 81 | { |
82 | - $this->assertInstanceOf( '\Aimeos\MShop\Attribute\Item\Iface', $attrItem ); |
|
83 | - $this->assertEquals( 3, count( $attrItem->getRefItems( 'text' ) ) ); |
|
82 | + $this->assertInstanceOf('\Aimeos\MShop\Attribute\Item\Iface', $attrItem); |
|
83 | + $this->assertEquals(3, count($attrItem->getRefItems('text'))); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | public function testSearchItems() |
89 | 89 | { |
90 | 90 | $filter = $this->object->createFilter(); |
91 | - $filter = $this->object->addFilterTypes( $filter, ['size'] ); |
|
91 | + $filter = $this->object->addFilterTypes($filter, ['size']); |
|
92 | 92 | |
93 | 93 | $total = 0; |
94 | - $results = $this->object->searchItems( $filter, ['text'], $total ); |
|
94 | + $results = $this->object->searchItems($filter, ['text'], $total); |
|
95 | 95 | |
96 | - $this->assertEquals( 6, $total ); |
|
97 | - $this->assertEquals( 6, count( $results ) ); |
|
96 | + $this->assertEquals(6, $total); |
|
97 | + $this->assertEquals(6, count($results)); |
|
98 | 98 | } |
99 | 99 | } |
@@ -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,26 +46,26 @@ 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 | - foreach( $decorators as $name ) |
|
52 | + foreach ($decorators as $name) |
|
53 | 53 | { |
54 | - if( ctype_alnum( $name ) === false ) |
|
54 | + if (ctype_alnum($name) === false) |
|
55 | 55 | { |
56 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
57 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
56 | + $classname = is_string($name) ? $classprefix . $name : '<not a string>'; |
|
57 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $classname = $classprefix . $name; |
61 | 61 | |
62 | - if( class_exists( $classname ) === false ) { |
|
63 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
62 | + if (class_exists($classname) === false) { |
|
63 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
64 | 64 | } |
65 | 65 | |
66 | - $controller = new $classname( $controller, $context ); |
|
66 | + $controller = new $classname($controller, $context); |
|
67 | 67 | |
68 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\Iface', $controller ); |
|
68 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\Iface', $controller); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | return $controller; |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * @param string $domain Domain name in lower case, e.g. "product" |
81 | 81 | * @return \Aimeos\Controller\Frontend\Common\Iface Controller object |
82 | 82 | */ |
83 | - protected static function addControllerDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
84 | - \Aimeos\Controller\Frontend\Iface $controller, $domain ) |
|
83 | + protected static function addControllerDecorators(\Aimeos\MShop\Context\Item\Iface $context, |
|
84 | + \Aimeos\Controller\Frontend\Iface $controller, $domain) |
|
85 | 85 | { |
86 | - if( !is_string( $domain ) || $domain === '' ) { |
|
87 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid domain "%1$s"', $domain ) ); |
|
86 | + if (!is_string($domain) || $domain === '') { |
|
87 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid domain "%1$s"', $domain)); |
|
88 | 88 | } |
89 | 89 | |
90 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $domain ) ) ); |
|
90 | + $localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $domain))); |
|
91 | 91 | $config = $context->getConfig(); |
92 | 92 | |
93 | 93 | /** controller/frontend/common/decorators/default |
@@ -112,26 +112,26 @@ discard block |
||
112 | 112 | * @since 2014.03 |
113 | 113 | * @category Developer |
114 | 114 | */ |
115 | - $decorators = $config->get( 'controller/frontend/common/decorators/default', [] ); |
|
116 | - $excludes = $config->get( 'controller/frontend/' . $domain . '/decorators/excludes', [] ); |
|
115 | + $decorators = $config->get('controller/frontend/common/decorators/default', []); |
|
116 | + $excludes = $config->get('controller/frontend/' . $domain . '/decorators/excludes', []); |
|
117 | 117 | |
118 | - foreach( $decorators as $key => $name ) |
|
118 | + foreach ($decorators as $key => $name) |
|
119 | 119 | { |
120 | - if( in_array( $name, $excludes ) ) { |
|
121 | - unset( $decorators[$key] ); |
|
120 | + if (in_array($name, $excludes)) { |
|
121 | + unset($decorators[$key]); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | 125 | $classprefix = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\'; |
126 | - $controller = self::addDecorators( $context, $controller, $decorators, $classprefix ); |
|
126 | + $controller = self::addDecorators($context, $controller, $decorators, $classprefix); |
|
127 | 127 | |
128 | 128 | $classprefix = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\'; |
129 | - $decorators = $config->get( 'controller/frontend/' . $domain . '/decorators/global', [] ); |
|
130 | - $controller = self::addDecorators( $context, $controller, $decorators, $classprefix ); |
|
129 | + $decorators = $config->get('controller/frontend/' . $domain . '/decorators/global', []); |
|
130 | + $controller = self::addDecorators($context, $controller, $decorators, $classprefix); |
|
131 | 131 | |
132 | - $classprefix = '\\Aimeos\\Controller\\Frontend\\' . ucfirst( $localClass ) . '\\Decorator\\'; |
|
133 | - $decorators = $config->get( 'controller/frontend/' . $domain . '/decorators/local', [] ); |
|
134 | - $controller = self::addDecorators( $context, $controller, $decorators, $classprefix ); |
|
132 | + $classprefix = '\\Aimeos\\Controller\\Frontend\\' . ucfirst($localClass) . '\\Decorator\\'; |
|
133 | + $decorators = $config->get('controller/frontend/' . $domain . '/decorators/local', []); |
|
134 | + $controller = self::addDecorators($context, $controller, $decorators, $classprefix); |
|
135 | 135 | |
136 | 136 | return $controller; |
137 | 137 | } |
@@ -145,19 +145,19 @@ discard block |
||
145 | 145 | * @param string $interface Name of the controller interface |
146 | 146 | * @return \Aimeos\Controller\Frontend\Common\Iface Controller object |
147 | 147 | */ |
148 | - protected static function createControllerBase( \Aimeos\MShop\Context\Item\Iface $context, $classname, $interface ) |
|
148 | + protected static function createControllerBase(\Aimeos\MShop\Context\Item\Iface $context, $classname, $interface) |
|
149 | 149 | { |
150 | - if( isset( self::$objects[$classname] ) ) { |
|
150 | + if (isset(self::$objects[$classname])) { |
|
151 | 151 | return self::$objects[$classname]; |
152 | 152 | } |
153 | 153 | |
154 | - if( class_exists( $classname ) === false ) { |
|
155 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
154 | + if (class_exists($classname) === false) { |
|
155 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
156 | 156 | } |
157 | 157 | |
158 | - $controller = new $classname( $context ); |
|
158 | + $controller = new $classname($context); |
|
159 | 159 | |
160 | - \Aimeos\MW\Common\Base::checkClass( $interface, $controller ); |
|
160 | + \Aimeos\MW\Common\Base::checkClass($interface, $controller); |
|
161 | 161 | |
162 | 162 | return $controller; |
163 | 163 | } |
@@ -20,97 +20,97 @@ |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | 22 | |
23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Standard' ) |
|
23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Standard') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' ) |
|
28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\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\MW\Common\Exception' ); |
|
43 | + $this->setExpectedException('\Aimeos\MW\Common\Exception'); |
|
44 | 44 | |
45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' ) |
|
46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\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\Locale\Standard' ) |
|
53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Standard') |
|
54 | 54 | ->disableOriginalConstructor() |
55 | - ->setMethods( ['invalid'] ) |
|
55 | + ->setMethods(['invalid']) |
|
56 | 56 | ->getMock(); |
57 | 57 | |
58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' ) |
|
59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\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 testCreateFilter() |
69 | 69 | { |
70 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' )->createSearch(); |
|
70 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'locale')->createSearch(); |
|
71 | 71 | |
72 | - $this->stub->expects( $this->once() )->method( 'createFilter' ) |
|
73 | - ->will( $this->returnValue( $search ) ); |
|
72 | + $this->stub->expects($this->once())->method('createFilter') |
|
73 | + ->will($this->returnValue($search)); |
|
74 | 74 | |
75 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() ); |
|
75 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter()); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | 79 | public function testGetItem() |
80 | 80 | { |
81 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' )->createItem(); |
|
81 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'locale')->createItem(); |
|
82 | 82 | |
83 | - $this->stub->expects( $this->once() )->method( 'getItem' ) |
|
84 | - ->will( $this->returnValue( $item ) ); |
|
83 | + $this->stub->expects($this->once())->method('getItem') |
|
84 | + ->will($this->returnValue($item)); |
|
85 | 85 | |
86 | - $this->assertInstanceOf( '\Aimeos\MShop\Locale\Item\Iface', $this->object->getItem( -1 ) ); |
|
86 | + $this->assertInstanceOf('\Aimeos\MShop\Locale\Item\Iface', $this->object->getItem( -1 )); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | 90 | public function testSearchItems() |
91 | 91 | { |
92 | - $filter = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' )->createSearch(); |
|
92 | + $filter = \Aimeos\MShop\Factory::createManager($this->context, 'locale')->createSearch(); |
|
93 | 93 | |
94 | - $this->stub->expects( $this->once() )->method( 'searchItems' ) |
|
95 | - ->will( $this->returnValue( [] ) ); |
|
94 | + $this->stub->expects($this->once())->method('searchItems') |
|
95 | + ->will($this->returnValue([])); |
|
96 | 96 | |
97 | - $this->assertEquals( [], $this->object->searchItems( $filter, ['media'] ) ); |
|
97 | + $this->assertEquals([], $this->object->searchItems($filter, ['media'])); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | 101 | public function testGetController() |
102 | 102 | { |
103 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
103 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
104 | 104 | |
105 | - $this->assertSame( $this->stub, $result ); |
|
105 | + $this->assertSame($this->stub, $result); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | - protected function access( $name ) |
|
109 | + protected function access($name) |
|
110 | 110 | { |
111 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' ); |
|
112 | - $method = $class->getMethod( $name ); |
|
113 | - $method->setAccessible( true ); |
|
111 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Locale\Decorator\Base'); |
|
112 | + $method = $class->getMethod($name); |
|
113 | + $method->setAccessible(true); |
|
114 | 114 | |
115 | 115 | return $method; |
116 | 116 | } |
@@ -15,31 +15,31 @@ |
||
15 | 15 | { |
16 | 16 | $target = '\\Aimeos\\Controller\\Frontend\\Locale\\Iface'; |
17 | 17 | |
18 | - $controller = \Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext() ); |
|
19 | - $this->assertInstanceOf( $target, $controller ); |
|
18 | + $controller = \Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext()); |
|
19 | + $this->assertInstanceOf($target, $controller); |
|
20 | 20 | |
21 | - $controller = \Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' ); |
|
22 | - $this->assertInstanceOf( $target, $controller ); |
|
21 | + $controller = \Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), 'Standard'); |
|
22 | + $this->assertInstanceOf($target, $controller); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | public function testCreateControllerInvalidImplementation() |
27 | 27 | { |
28 | - $this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' ); |
|
29 | - \Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' ); |
|
28 | + $this->setExpectedException('\\Aimeos\\MW\\Common\\Exception'); |
|
29 | + \Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | public function testCreateControllerInvalidName() |
34 | 34 | { |
35 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
36 | - \Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
35 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
36 | + \Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), '%^'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | 40 | public function testCreateControllerNotExisting() |
41 | 41 | { |
42 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
43 | - \Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
42 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
43 | + \Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
44 | 44 | } |
45 | 45 | } |
@@ -20,122 +20,122 @@ |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | 22 | |
23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Standard' ) |
|
23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\Standard') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Decorator\Base' ) |
|
28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\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\MW\Common\Exception' ); |
|
43 | + $this->setExpectedException('\Aimeos\MW\Common\Exception'); |
|
44 | 44 | |
45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Decorator\Base' ) |
|
46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\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\Subscription\Standard' ) |
|
53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\Standard') |
|
54 | 54 | ->disableOriginalConstructor() |
55 | - ->setMethods( ['invalid'] ) |
|
55 | + ->setMethods(['invalid']) |
|
56 | 56 | ->getMock(); |
57 | 57 | |
58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Decorator\Base' ) |
|
59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\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 testCancel() |
69 | 69 | { |
70 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' )->createItem(); |
|
70 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'subscription')->createItem(); |
|
71 | 71 | |
72 | - $this->stub->expects( $this->once() )->method( 'cancel' )->will( $this->returnValue( $item ) ); |
|
72 | + $this->stub->expects($this->once())->method('cancel')->will($this->returnValue($item)); |
|
73 | 73 | |
74 | - $this->assertInstanceOf( '\Aimeos\MShop\Subscription\Item\Iface', $this->object->cancel( -1, '' ) ); |
|
74 | + $this->assertInstanceOf('\Aimeos\MShop\Subscription\Item\Iface', $this->object->cancel( -1, '' )); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testCreateFilter() |
79 | 79 | { |
80 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' )->createSearch(); |
|
80 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'subscription')->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, 'subscription' )->createItem(); |
|
90 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'subscription')->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\Subscription\Item\Iface', $this->object->getItem( -1 ) ); |
|
94 | + $this->assertInstanceOf('\Aimeos\MShop\Subscription\Item\Iface', $this->object->getItem( -1 )); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
98 | 98 | public function testSaveItem() |
99 | 99 | { |
100 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' )->createItem(); |
|
100 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'subscription')->createItem(); |
|
101 | 101 | |
102 | - $this->stub->expects( $this->once() )->method( 'saveItem' ); |
|
102 | + $this->stub->expects($this->once())->method('saveItem'); |
|
103 | 103 | |
104 | - $this->object->saveItem( $item ); |
|
104 | + $this->object->saveItem($item); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | public function testSearchItems() |
109 | 109 | { |
110 | - $search = $this->getMockBuilder( '\Aimeos\MW\Criteria\Iface' )->getMock(); |
|
110 | + $search = $this->getMockBuilder('\Aimeos\MW\Criteria\Iface')->getMock(); |
|
111 | 111 | |
112 | - $this->stub->expects( $this->once() )->method( 'searchItems' )->will( $this->returnValue( [] ) ); |
|
112 | + $this->stub->expects($this->once())->method('searchItems')->will($this->returnValue([])); |
|
113 | 113 | |
114 | - $this->assertEquals( [], $this->object->searchItems( $search ) ); |
|
114 | + $this->assertEquals([], $this->object->searchItems($search)); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | 118 | public function testGetIntervals() |
119 | 119 | { |
120 | - $this->stub->expects( $this->once() )->method( 'getIntervals' )->will( $this->returnValue( [] ) ); |
|
120 | + $this->stub->expects($this->once())->method('getIntervals')->will($this->returnValue([])); |
|
121 | 121 | |
122 | - $this->assertEquals( [], $this->object->getIntervals() ); |
|
122 | + $this->assertEquals([], $this->object->getIntervals()); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
126 | 126 | public function testGetController() |
127 | 127 | { |
128 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
128 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
129 | 129 | |
130 | - $this->assertSame( $this->stub, $result ); |
|
130 | + $this->assertSame($this->stub, $result); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
134 | - protected function access( $name ) |
|
134 | + protected function access($name) |
|
135 | 135 | { |
136 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Subscription\Decorator\Base' ); |
|
137 | - $method = $class->getMethod( $name ); |
|
138 | - $method->setAccessible( true ); |
|
136 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Subscription\Decorator\Base'); |
|
137 | + $method = $class->getMethod($name); |
|
138 | + $method->setAccessible(true); |
|
139 | 139 | |
140 | 140 | return $method; |
141 | 141 | } |
@@ -15,31 +15,31 @@ |
||
15 | 15 | { |
16 | 16 | $target = '\\Aimeos\\Controller\\Frontend\\Subscription\\Iface'; |
17 | 17 | |
18 | - $controller = \Aimeos\Controller\Frontend\Subscription\Factory::createController( \TestHelperFrontend::getContext() ); |
|
19 | - $this->assertInstanceOf( $target, $controller ); |
|
18 | + $controller = \Aimeos\Controller\Frontend\Subscription\Factory::createController(\TestHelperFrontend::getContext()); |
|
19 | + $this->assertInstanceOf($target, $controller); |
|
20 | 20 | |
21 | - $controller = \Aimeos\Controller\Frontend\Subscription\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' ); |
|
22 | - $this->assertInstanceOf( $target, $controller ); |
|
21 | + $controller = \Aimeos\Controller\Frontend\Subscription\Factory::createController(\TestHelperFrontend::getContext(), 'Standard'); |
|
22 | + $this->assertInstanceOf($target, $controller); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | public function testCreateControllerInvalidImplementation() |
27 | 27 | { |
28 | - $this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' ); |
|
29 | - \Aimeos\Controller\Frontend\Subscription\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' ); |
|
28 | + $this->setExpectedException('\\Aimeos\\MW\\Common\\Exception'); |
|
29 | + \Aimeos\Controller\Frontend\Subscription\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | public function testCreateControllerInvalidName() |
34 | 34 | { |
35 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
36 | - \Aimeos\Controller\Frontend\Subscription\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
35 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
36 | + \Aimeos\Controller\Frontend\Subscription\Factory::createController(\TestHelperFrontend::getContext(), '%^'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | 40 | public function testCreateControllerNotExisting() |
41 | 41 | { |
42 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
43 | - \Aimeos\Controller\Frontend\Subscription\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
42 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
43 | + \Aimeos\Controller\Frontend\Subscription\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
44 | 44 | } |
45 | 45 | } |