@@ -17,92 +17,92 @@ |
||
17 | 17 | { |
18 | 18 | public function testCreateController() |
19 | 19 | { |
20 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket' ); |
|
21 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Frontend\\Common\\Iface', $controller ); |
|
20 | + $controller = \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket'); |
|
21 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Frontend\\Common\\Iface', $controller); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | public function testCreateControllerEmpty() |
26 | 26 | { |
27 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
28 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), "\t\n" ); |
|
27 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
28 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), "\t\n"); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | public function testCreateControllerInvalidName() |
33 | 33 | { |
34 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
35 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
34 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
35 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), '%^'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testCreateControllerNotExisting() |
40 | 40 | { |
41 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
42 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
41 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
42 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | public function testCreateSubControllerNotExisting() |
47 | 47 | { |
48 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
49 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket/notexist' ); |
|
48 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
49 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket/notexist'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testClear() |
54 | 54 | { |
55 | - $cache = \Aimeos\Controller\Frontend\Factory::setCache( true ); |
|
55 | + $cache = \Aimeos\Controller\Frontend\Factory::setCache(true); |
|
56 | 56 | |
57 | 57 | $context = \TestHelperFrontend::getContext(); |
58 | 58 | |
59 | - $controller1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
59 | + $controller1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
60 | 60 | \Aimeos\Controller\Frontend\Factory::clear(); |
61 | - $controller2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
61 | + $controller2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
62 | 62 | |
63 | - \Aimeos\Controller\Frontend\Factory::setCache( $cache ); |
|
63 | + \Aimeos\Controller\Frontend\Factory::setCache($cache); |
|
64 | 64 | |
65 | - $this->assertNotSame( $controller1, $controller2 ); |
|
65 | + $this->assertNotSame($controller1, $controller2); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testClearSite() |
70 | 70 | { |
71 | - $cache = \Aimeos\Controller\Frontend\Factory::setCache( true ); |
|
71 | + $cache = \Aimeos\Controller\Frontend\Factory::setCache(true); |
|
72 | 72 | |
73 | 73 | $context = \TestHelperFrontend::getContext(); |
74 | 74 | |
75 | - $basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
76 | - $catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
77 | - \Aimeos\Controller\Frontend\Factory::clear( (string) $context ); |
|
75 | + $basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
76 | + $catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
77 | + \Aimeos\Controller\Frontend\Factory::clear((string) $context); |
|
78 | 78 | |
79 | - $basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
80 | - $catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
79 | + $basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
80 | + $catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
81 | 81 | |
82 | - \Aimeos\Controller\Frontend\Factory::setCache( $cache ); |
|
82 | + \Aimeos\Controller\Frontend\Factory::setCache($cache); |
|
83 | 83 | |
84 | - $this->assertNotSame( $basket1, $basket2 ); |
|
85 | - $this->assertNotSame( $catalog1, $catalog2 ); |
|
84 | + $this->assertNotSame($basket1, $basket2); |
|
85 | + $this->assertNotSame($catalog1, $catalog2); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | 89 | public function testClearSpecific() |
90 | 90 | { |
91 | - $cache = \Aimeos\Controller\Frontend\Factory::setCache( true ); |
|
91 | + $cache = \Aimeos\Controller\Frontend\Factory::setCache(true); |
|
92 | 92 | |
93 | 93 | $context = \TestHelperFrontend::getContext(); |
94 | 94 | |
95 | - $basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
96 | - $catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
97 | - \Aimeos\Controller\Frontend\Factory::clear( (string) $context, 'basket' ); |
|
95 | + $basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
96 | + $catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
97 | + \Aimeos\Controller\Frontend\Factory::clear((string) $context, 'basket'); |
|
98 | 98 | |
99 | - $basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
100 | - $catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
99 | + $basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
100 | + $catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
101 | 101 | |
102 | - \Aimeos\Controller\Frontend\Factory::setCache( $cache ); |
|
102 | + \Aimeos\Controller\Frontend\Factory::setCache($cache); |
|
103 | 103 | |
104 | - $this->assertNotSame( $basket1, $basket2 ); |
|
105 | - $this->assertSame( $catalog1, $catalog2 ); |
|
104 | + $this->assertNotSame($basket1, $basket2); |
|
105 | + $this->assertSame($catalog1, $catalog2); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | } |
109 | 109 | \ No newline at end of file |
@@ -12,20 +12,20 @@ discard block |
||
12 | 12 | { |
13 | 13 | public function testCreateControllerInvalidImplementation() |
14 | 14 | { |
15 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
16 | - \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' ); |
|
15 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
16 | + \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function testCreateControllerInvalidName() |
20 | 20 | { |
21 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
22 | - \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
21 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
22 | + \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), '%^'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function testCreateControllerNotExisting() |
26 | 26 | { |
27 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
28 | - \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
27 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
28 | + \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function testAbstractAddControllerDecoratorsWithExclude() |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | $context = \TestHelperFrontend::getContext(); |
34 | 34 | $config = $context->getConfig(); |
35 | 35 | |
36 | - $config->set( 'controller/frontend/common/decorators/default', array( 'Example' ) ); |
|
37 | - $config->set( 'controller/frontend/service/decorators/excludes', array( 'Example' ) ); |
|
36 | + $config->set('controller/frontend/common/decorators/default', array('Example')); |
|
37 | + $config->set('controller/frontend/service/decorators/excludes', array('Example')); |
|
38 | 38 | |
39 | - $controller = \Aimeos\Controller\Frontend\Service\Factory::createController( $context, 'Standard' ); |
|
39 | + $controller = \Aimeos\Controller\Frontend\Service\Factory::createController($context, 'Standard'); |
|
40 | 40 | |
41 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Frontend\\Common\\Iface', $controller ); |
|
41 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Frontend\\Common\\Iface', $controller); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // using Factorylocal class |
45 | 45 | public function testAbstractAddControllerDecoratorsNoDomainException() |
46 | 46 | { |
47 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
48 | - \Aimeos\Controller\Frontend\Service\Factorylocal::createController( \TestHelperFrontend::getContext(), 'Standard', '' ); |
|
47 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
48 | + \Aimeos\Controller\Frontend\Service\Factorylocal::createController(\TestHelperFrontend::getContext(), 'Standard', ''); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function testAbstractAddDecorators() |
@@ -53,47 +53,47 @@ discard block |
||
53 | 53 | $context = \TestHelperFrontend::getContext(); |
54 | 54 | $config = $context->getConfig(); |
55 | 55 | |
56 | - $config->set( 'controller/frontend/common/decorators/default', array( 'Example', 'Example' ) ); |
|
57 | - $config->set( 'controller/frontend/service/decorators/excludes', array() ); |
|
56 | + $config->set('controller/frontend/common/decorators/default', array('Example', 'Example')); |
|
57 | + $config->set('controller/frontend/service/decorators/excludes', array()); |
|
58 | 58 | |
59 | - $controller = \Aimeos\Controller\Frontend\Service\Factory::createController( $context, 'Standard' ); |
|
59 | + $controller = \Aimeos\Controller\Frontend\Service\Factory::createController($context, 'Standard'); |
|
60 | 60 | |
61 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\Iface', $controller ); |
|
61 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\Iface', $controller); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public function testAbstractAddDecoratorsExceptionWrongName() |
65 | 65 | { |
66 | 66 | $context = \TestHelperFrontend::getContext(); |
67 | 67 | $config = $context->getConfig(); |
68 | - $config->set( 'controller/frontend/common/decorators/default', array( '$$' ) ); |
|
68 | + $config->set('controller/frontend/common/decorators/default', array('$$')); |
|
69 | 69 | |
70 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
71 | - \Aimeos\Controller\Frontend\Service\Factory::createController( $context, 'Standard' ); |
|
70 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
71 | + \Aimeos\Controller\Frontend\Service\Factory::createController($context, 'Standard'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function testAbstractAddDecoratorsExceptionWrongClass() |
75 | 75 | { |
76 | 76 | $context = \TestHelperFrontend::getContext(); |
77 | 77 | $config = $context->getConfig(); |
78 | - $config->set( 'controller/frontend/common/decorators/default', array( 'WrongClass' ) ); |
|
78 | + $config->set('controller/frontend/common/decorators/default', array('WrongClass')); |
|
79 | 79 | |
80 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
81 | - \Aimeos\Controller\Frontend\Service\Factory::createController( $context, 'Standard' ); |
|
80 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
81 | + \Aimeos\Controller\Frontend\Service\Factory::createController($context, 'Standard'); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | public function testCreateController() |
85 | 85 | { |
86 | 86 | $context = \TestHelperFrontend::getContext(); |
87 | 87 | $config = $context->getConfig(); |
88 | - $config->set( 'controller/frontend/common/decorators/default', array() ); |
|
88 | + $config->set('controller/frontend/common/decorators/default', array()); |
|
89 | 89 | |
90 | 90 | $target = '\\Aimeos\\Controller\\Frontend\\Service\\Iface'; |
91 | 91 | |
92 | - $controller = \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext() ); |
|
93 | - $this->assertInstanceOf( $target, $controller ); |
|
92 | + $controller = \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext()); |
|
93 | + $this->assertInstanceOf($target, $controller); |
|
94 | 94 | |
95 | - $controller = \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' ); |
|
96 | - $this->assertInstanceOf( $target, $controller ); |
|
95 | + $controller = \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), 'Standard'); |
|
96 | + $this->assertInstanceOf($target, $controller); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | } |
@@ -16,130 +16,130 @@ discard block |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - $this->object = new \Aimeos\Controller\Frontend\Service\Standard( \TestHelperFrontend::getContext() ); |
|
19 | + $this->object = new \Aimeos\Controller\Frontend\Service\Standard(\TestHelperFrontend::getContext()); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | 23 | public static function setUpBeforeClass() |
24 | 24 | { |
25 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
26 | - $orderBaseMgr = $orderManager->getSubManager( 'base' ); |
|
25 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
26 | + $orderBaseMgr = $orderManager->getSubManager('base'); |
|
27 | 27 | self::$basket = $orderBaseMgr->createItem(); |
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function tearDown() |
32 | 32 | { |
33 | - unset( $this->object ); |
|
33 | + unset($this->object); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testGetServices() |
38 | 38 | { |
39 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
40 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
39 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
40 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
41 | 41 | |
42 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
43 | - $this->assertGreaterThan( 0, count( $services ) ); |
|
42 | + $services = $this->object->getServices('delivery', $basket); |
|
43 | + $this->assertGreaterThan(0, count($services)); |
|
44 | 44 | |
45 | - foreach( $services as $service ) { |
|
46 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Item\\Iface', $service ); |
|
45 | + foreach ($services as $service) { |
|
46 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Item\\Iface', $service); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testGetServicesCache() |
52 | 52 | { |
53 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
54 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
53 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
54 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
55 | 55 | |
56 | - $this->object->getServices( 'delivery', $basket ); |
|
57 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
56 | + $this->object->getServices('delivery', $basket); |
|
57 | + $services = $this->object->getServices('delivery', $basket); |
|
58 | 58 | |
59 | - $this->assertGreaterThan( 0, count( $services ) ); |
|
59 | + $this->assertGreaterThan(0, count($services)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | public function testGetServiceAttributes() |
64 | 64 | { |
65 | 65 | $service = $this->getServiceItem(); |
66 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
66 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
67 | 67 | |
68 | - $this->assertEquals( 0, count( $attributes ) ); |
|
68 | + $this->assertEquals(0, count($attributes)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | 72 | public function testGetServiceAttributesCache() |
73 | 73 | { |
74 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
75 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
74 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
75 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
76 | 76 | |
77 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
77 | + $services = $this->object->getServices('delivery', $basket); |
|
78 | 78 | |
79 | - if( ( $service = reset( $services ) ) === false ) { |
|
80 | - throw new \Exception( 'No service item found' ); |
|
79 | + if (($service = reset($services)) === false) { |
|
80 | + throw new \Exception('No service item found'); |
|
81 | 81 | } |
82 | 82 | |
83 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
83 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
84 | 84 | |
85 | - $this->assertEquals( 0, count( $attributes ) ); |
|
85 | + $this->assertEquals(0, count($attributes)); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | 89 | public function testGetServiceAttributesNoItems() |
90 | 90 | { |
91 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Service\\Exception' ); |
|
92 | - $this->object->getServiceAttributes( 'invalid', -1, self::$basket ); |
|
91 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Service\\Exception'); |
|
92 | + $this->object->getServiceAttributes('invalid', -1, self::$basket); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
96 | 96 | public function testGetServicePrice() |
97 | 97 | { |
98 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
99 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
98 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
99 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
100 | 100 | |
101 | 101 | $service = $this->getServiceItem(); |
102 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
102 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
103 | 103 | |
104 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
105 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
104 | + $this->assertEquals('12.95', $price->getValue()); |
|
105 | + $this->assertEquals('1.99', $price->getCosts()); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | public function testGetServicePriceCache() |
110 | 110 | { |
111 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
112 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
111 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
112 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
113 | 113 | |
114 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
114 | + $services = $this->object->getServices('delivery', $basket); |
|
115 | 115 | |
116 | - if( ( $service = reset( $services ) ) === false ) { |
|
117 | - throw new \Exception( 'No service item found' ); |
|
116 | + if (($service = reset($services)) === false) { |
|
117 | + throw new \Exception('No service item found'); |
|
118 | 118 | } |
119 | 119 | |
120 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
120 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
121 | 121 | |
122 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
123 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
122 | + $this->assertEquals('12.95', $price->getValue()); |
|
123 | + $this->assertEquals('1.99', $price->getCosts()); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
127 | 127 | public function testGetServicePriceNoItems() |
128 | 128 | { |
129 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
130 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
129 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
130 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
131 | 131 | |
132 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Service\\Exception' ); |
|
133 | - $this->object->getServicePrice( 'invalid', -1, $basket ); |
|
132 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Service\\Exception'); |
|
133 | + $this->object->getServicePrice('invalid', -1, $basket); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
137 | 137 | public function testCheckServiceAttributes() |
138 | 138 | { |
139 | 139 | $service = $this->getServiceItem(); |
140 | - $attributes = $this->object->checkServiceAttributes( 'delivery', $service->getId(), array() ); |
|
140 | + $attributes = $this->object->checkServiceAttributes('delivery', $service->getId(), array()); |
|
141 | 141 | |
142 | - $this->assertEquals( array(), $attributes ); |
|
142 | + $this->assertEquals(array(), $attributes); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -148,21 +148,21 @@ discard block |
||
148 | 148 | */ |
149 | 149 | protected function getServiceItem() |
150 | 150 | { |
151 | - $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
151 | + $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
152 | 152 | |
153 | - $search = $serviceManager->createSearch( true ); |
|
153 | + $search = $serviceManager->createSearch(true); |
|
154 | 154 | $expr = array( |
155 | 155 | $search->getConditions(), |
156 | - $search->compare( '==', 'service.provider', 'Standard' ), |
|
157 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
158 | - $search->compare( '==', 'service.type.code', 'delivery' ), |
|
156 | + $search->compare('==', 'service.provider', 'Standard'), |
|
157 | + $search->compare('==', 'service.type.domain', 'service'), |
|
158 | + $search->compare('==', 'service.type.code', 'delivery'), |
|
159 | 159 | ); |
160 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
160 | + $search->setConditions($search->combine('&&', $expr)); |
|
161 | 161 | |
162 | - $services = $serviceManager->searchItems( $search ); |
|
162 | + $services = $serviceManager->searchItems($search); |
|
163 | 163 | |
164 | - if( ( $service = reset( $services ) ) === false ) { |
|
165 | - throw new \Exception( 'No service item found' ); |
|
164 | + if (($service = reset($services)) === false) { |
|
165 | + throw new \Exception('No service item found'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | return $service; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | protected function setUp() |
23 | 23 | { |
24 | 24 | $context = \TestHelperFrontend::getContext(); |
25 | - $controller = \Aimeos\Controller\Frontend\Service\Factory::createController( $context, 'Standard' ); |
|
26 | - $this->object = new \Aimeos\Controller\Frontend\Service\Decorator\Example( $controller, $context ); |
|
25 | + $controller = \Aimeos\Controller\Frontend\Service\Factory::createController($context, 'Standard'); |
|
26 | + $this->object = new \Aimeos\Controller\Frontend\Service\Decorator\Example($controller, $context); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | public function testCall() |
43 | 43 | { |
44 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Service\\Exception' ); |
|
45 | - $this->object->checkServiceAttributes( 'delivery', -1, array() ); |
|
44 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Service\\Exception'); |
|
45 | + $this->object->checkServiceAttributes('delivery', -1, array()); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | } |
@@ -24,20 +24,20 @@ |
||
24 | 24 | /** |
25 | 25 | * @param string $name |
26 | 26 | */ |
27 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null, $domainToTest = 'service' ) |
|
27 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null, $domainToTest = 'service') |
|
28 | 28 | { |
29 | - if( $name === null ) { |
|
30 | - $name = $context->getConfig()->get( 'controller/frontend/service/name', 'Standard' ); |
|
29 | + if ($name === null) { |
|
30 | + $name = $context->getConfig()->get('controller/frontend/service/name', 'Standard'); |
|
31 | 31 | } |
32 | 32 | |
33 | - if( ctype_alnum( $name ) === false ) { |
|
34 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $name ) ); |
|
33 | + if (ctype_alnum($name) === false) { |
|
34 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $name)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $iface = '\\Aimeos\\Controller\\Frontend\\Service\\Iface'; |
38 | 38 | $classname = '\\Aimeos\\Controller\\Frontend\\Service\\' . $name; |
39 | 39 | |
40 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
41 | - return self::addControllerDecorators( $context, $manager, $domainToTest ); |
|
40 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
41 | + return self::addControllerDecorators($context, $manager, $domainToTest); |
|
42 | 42 | } |
43 | 43 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | protected function setUp() |
17 | 17 | { |
18 | - $this->object = new \Aimeos\Controller\Frontend\Exception( 'msg', 1, null, array( 'key' => 'value' ) ); |
|
18 | + $this->object = new \Aimeos\Controller\Frontend\Exception('msg', 1, null, array('key' => 'value')); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | |
27 | 27 | public function testGetMessage() |
28 | 28 | { |
29 | - $this->assertEquals( 'msg', $this->object->getMessage() ); |
|
29 | + $this->assertEquals('msg', $this->object->getMessage()); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | public function testGetCode() |
34 | 34 | { |
35 | - $this->assertEquals( 1, $this->object->getCode() ); |
|
35 | + $this->assertEquals(1, $this->object->getCode()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetErrorList() |
40 | 40 | { |
41 | - $this->assertEquals( array( 'key' => 'value' ), $this->object->getErrorList() ); |
|
41 | + $this->assertEquals(array('key' => 'value'), $this->object->getErrorList()); |
|
42 | 42 | } |
43 | 43 | } |
@@ -29,33 +29,33 @@ |
||
29 | 29 | $this->context = \TestHelperFrontend::getContext(); |
30 | 30 | $config = $this->context->getConfig(); |
31 | 31 | |
32 | - $config->set( 'controller/frontend/common/decorators/default', array() ); |
|
33 | - $config->set( 'controller/frontend/admin/decorators/global', array() ); |
|
34 | - $config->set( 'controller/frontend/admin/decorators/local', array() ); |
|
32 | + $config->set('controller/frontend/common/decorators/default', array()); |
|
33 | + $config->set('controller/frontend/admin/decorators/global', array()); |
|
34 | + $config->set('controller/frontend/admin/decorators/local', array()); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testInjectController() |
40 | 40 | { |
41 | - $controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' ); |
|
42 | - \Aimeos\Controller\Frontend\Catalog\Factory::injectController( '\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller ); |
|
41 | + $controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard'); |
|
42 | + \Aimeos\Controller\Frontend\Catalog\Factory::injectController('\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller); |
|
43 | 43 | |
44 | - $injectedController = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' ); |
|
44 | + $injectedController = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard'); |
|
45 | 45 | |
46 | - $this->assertSame( $controller, $injectedController ); |
|
46 | + $this->assertSame($controller, $injectedController); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testInjectControllerReset() |
51 | 51 | { |
52 | - $controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' ); |
|
53 | - \Aimeos\Controller\Frontend\Catalog\Factory::injectController( '\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller ); |
|
54 | - \Aimeos\Controller\Frontend\Catalog\Factory::injectController( '\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', null ); |
|
52 | + $controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard'); |
|
53 | + \Aimeos\Controller\Frontend\Catalog\Factory::injectController('\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller); |
|
54 | + \Aimeos\Controller\Frontend\Catalog\Factory::injectController('\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', null); |
|
55 | 55 | |
56 | - $new = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' ); |
|
56 | + $new = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard'); |
|
57 | 57 | |
58 | - $this->assertNotSame( $controller, $new ); |
|
58 | + $this->assertNotSame($controller, $new); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | } |
62 | 62 | \ No newline at end of file |
@@ -14,31 +14,31 @@ |
||
14 | 14 | { |
15 | 15 | $target = '\\Aimeos\\Controller\\Frontend\\Basket\\Iface'; |
16 | 16 | |
17 | - $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext() ); |
|
18 | - $this->assertInstanceOf( $target, $controller ); |
|
17 | + $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext()); |
|
18 | + $this->assertInstanceOf($target, $controller); |
|
19 | 19 | |
20 | - $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' ); |
|
21 | - $this->assertInstanceOf( $target, $controller ); |
|
20 | + $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'Standard'); |
|
21 | + $this->assertInstanceOf($target, $controller); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | public function testCreateControllerInvalidImplementation() |
26 | 26 | { |
27 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
28 | - \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' ); |
|
27 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
28 | + \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | public function testCreateControllerInvalidName() |
33 | 33 | { |
34 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
35 | - \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
34 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
35 | + \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), '%^'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testCreateControllerNotExisting() |
40 | 40 | { |
41 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
42 | - \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
41 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
42 | + \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
43 | 43 | } |
44 | 44 | } |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | 20 | $this->context = \TestHelperFrontend::getContext(); |
21 | - $this->object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
|
21 | + $this->object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context); |
|
22 | 22 | |
23 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
23 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
24 | 24 | |
25 | 25 | $search = $productManager->createSearch(); |
26 | - $search->setConditions( $search->compare( '==', 'product.code', 'U:TESTP' ) ); |
|
26 | + $search->setConditions($search->compare('==', 'product.code', 'U:TESTP')); |
|
27 | 27 | |
28 | - $items = $productManager->searchItems( $search, array( 'text' ) ); |
|
28 | + $items = $productManager->searchItems($search, array('text')); |
|
29 | 29 | |
30 | - if( ( $this->testItem = reset( $items ) ) === false ) { |
|
31 | - throw new \Exception( 'Product not found' ); |
|
30 | + if (($this->testItem = reset($items)) === false) { |
|
31 | + throw new \Exception('Product not found'); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | protected function tearDown() |
37 | 37 | { |
38 | 38 | $this->object->clear(); |
39 | - $this->context->getSession()->set( 'aimeos', array() ); |
|
39 | + $this->context->getSession()->set('aimeos', array()); |
|
40 | 40 | |
41 | - unset( $this->object, $this->testItem ); |
|
41 | + unset($this->object, $this->testItem); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -47,584 +47,584 @@ discard block |
||
47 | 47 | $basket = $this->object->get(); |
48 | 48 | |
49 | 49 | |
50 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
50 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
51 | 51 | |
52 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
53 | - $this->assertEquals( 2, $basket->getProduct( 0 )->getQuantity() ); |
|
54 | - $this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() ); |
|
52 | + $this->assertEquals(1, count($basket->getProducts())); |
|
53 | + $this->assertEquals(2, $basket->getProduct(0)->getQuantity()); |
|
54 | + $this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode()); |
|
55 | 55 | |
56 | 56 | |
57 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
57 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
58 | 58 | |
59 | 59 | $search = $productManager->createSearch(); |
60 | - $search->setConditions( $search->compare( '==', 'product.code', 'CNC' ) ); |
|
60 | + $search->setConditions($search->compare('==', 'product.code', 'CNC')); |
|
61 | 61 | |
62 | - $items = $productManager->searchItems( $search, array( 'text' ) ); |
|
62 | + $items = $productManager->searchItems($search, array('text')); |
|
63 | 63 | |
64 | - if( ( $item = reset( $items ) ) === false ) { |
|
65 | - throw new \Exception( 'Product not found' ); |
|
64 | + if (($item = reset($items)) === false) { |
|
65 | + throw new \Exception('Product not found'); |
|
66 | 66 | } |
67 | 67 | |
68 | - $this->object->addProduct( $item->getId(), 2, array(), array(), array(), array(), array(), 'default' ); |
|
69 | - $item2 = $this->object->get()->getProduct( 1 ); |
|
70 | - $this->object->deleteProduct( 0 ); |
|
68 | + $this->object->addProduct($item->getId(), 2, array(), array(), array(), array(), array(), 'default'); |
|
69 | + $item2 = $this->object->get()->getProduct(1); |
|
70 | + $this->object->deleteProduct(0); |
|
71 | 71 | |
72 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
73 | - $this->assertEquals( $item2, $basket->getProduct( 1 ) ); |
|
74 | - $this->assertEquals( 'CNC', $basket->getProduct( 1 )->getProductCode() ); |
|
72 | + $this->assertEquals(1, count($basket->getProducts())); |
|
73 | + $this->assertEquals($item2, $basket->getProduct(1)); |
|
74 | + $this->assertEquals('CNC', $basket->getProduct(1)->getProductCode()); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testAddProductBundle() |
79 | 79 | { |
80 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
80 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
81 | 81 | |
82 | 82 | $search = $productManager->createSearch(); |
83 | - $search->setConditions( $search->compare( '==', 'product.code', 'U:BUNDLE' ) ); |
|
83 | + $search->setConditions($search->compare('==', 'product.code', 'U:BUNDLE')); |
|
84 | 84 | |
85 | - $items = $productManager->searchItems( $search ); |
|
85 | + $items = $productManager->searchItems($search); |
|
86 | 86 | |
87 | - if( ( $item = reset( $items ) ) === false ) { |
|
88 | - throw new \Exception( 'Product not found' ); |
|
87 | + if (($item = reset($items)) === false) { |
|
88 | + throw new \Exception('Product not found'); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
92 | - $this->object->addProduct( $item->getId(), 1 ); |
|
92 | + $this->object->addProduct($item->getId(), 1); |
|
93 | 93 | |
94 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
95 | - $this->assertEquals( 'U:BUNDLE', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
96 | - $this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getProducts() ) ); |
|
94 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
95 | + $this->assertEquals('U:BUNDLE', $this->object->get()->getProduct(0)->getProductCode()); |
|
96 | + $this->assertEquals(2, count($this->object->get()->getProduct(0)->getProducts())); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
100 | 100 | public function testAddProductVariant() |
101 | 101 | { |
102 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
102 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
103 | 103 | |
104 | 104 | $search = $productManager->createSearch(); |
105 | - $search->setConditions( $search->compare( '==', 'product.code', 'CNC' ) ); |
|
105 | + $search->setConditions($search->compare('==', 'product.code', 'CNC')); |
|
106 | 106 | |
107 | - $items = $productManager->searchItems( $search, array( 'text' ) ); |
|
107 | + $items = $productManager->searchItems($search, array('text')); |
|
108 | 108 | |
109 | - if( ( $item = reset( $items ) ) === false ) { |
|
110 | - throw new \Exception( 'Product not found' ); |
|
109 | + if (($item = reset($items)) === false) { |
|
110 | + throw new \Exception('Product not found'); |
|
111 | 111 | } |
112 | 112 | |
113 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
113 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
114 | 114 | |
115 | 115 | $search = $attributeManager->createSearch(); |
116 | - $search->setConditions( $search->compare( '==', 'attribute.code', array( 'xs', 'white' ) ) ); |
|
116 | + $search->setConditions($search->compare('==', 'attribute.code', array('xs', 'white'))); |
|
117 | 117 | |
118 | - $attributes = $attributeManager->searchItems( $search ); |
|
118 | + $attributes = $attributeManager->searchItems($search); |
|
119 | 119 | |
120 | - if( count( $attributes ) === 0 ) { |
|
121 | - throw new \Exception( 'Attributes not found' ); |
|
120 | + if (count($attributes) === 0) { |
|
121 | + throw new \Exception('Attributes not found'); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
125 | - $this->object->addProduct( $item->getId(), 1, array(), array_keys( $attributes ), array(), array(), array(), 'default' ); |
|
125 | + $this->object->addProduct($item->getId(), 1, array(), array_keys($attributes), array(), array(), array(), 'default'); |
|
126 | 126 | |
127 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
128 | - $this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
127 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
128 | + $this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode()); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | public function testAddProductVariantIncomplete() |
133 | 133 | { |
134 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
134 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
135 | 135 | |
136 | 136 | $search = $productManager->createSearch(); |
137 | - $search->setConditions( $search->compare( '==', 'product.code', 'U:TEST' ) ); |
|
137 | + $search->setConditions($search->compare('==', 'product.code', 'U:TEST')); |
|
138 | 138 | |
139 | - $items = $productManager->searchItems( $search, array() ); |
|
139 | + $items = $productManager->searchItems($search, array()); |
|
140 | 140 | |
141 | - if( ( $item = reset( $items ) ) === false ) { |
|
142 | - throw new \Exception( 'Product not found' ); |
|
141 | + if (($item = reset($items)) === false) { |
|
142 | + throw new \Exception('Product not found'); |
|
143 | 143 | } |
144 | 144 | |
145 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
145 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
146 | 146 | |
147 | 147 | $search = $attributeManager->createSearch(); |
148 | 148 | $expr = array( |
149 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
150 | - $search->compare( '==', 'attribute.code', '30' ), |
|
151 | - $search->compare( '==', 'attribute.type.code', 'length' ), |
|
149 | + $search->compare('==', 'attribute.domain', 'product'), |
|
150 | + $search->compare('==', 'attribute.code', '30'), |
|
151 | + $search->compare('==', 'attribute.type.code', 'length'), |
|
152 | 152 | ); |
153 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
153 | + $search->setConditions($search->combine('&&', $expr)); |
|
154 | 154 | |
155 | - $attributes = $attributeManager->searchItems( $search ); |
|
155 | + $attributes = $attributeManager->searchItems($search); |
|
156 | 156 | |
157 | - if( count( $attributes ) === 0 ) { |
|
158 | - throw new \Exception( 'Attributes not found' ); |
|
157 | + if (count($attributes) === 0) { |
|
158 | + throw new \Exception('Attributes not found'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | - $this->object->addProduct( $item->getId(), 1, array(), array_keys( $attributes ) ); |
|
162 | + $this->object->addProduct($item->getId(), 1, array(), array_keys($attributes)); |
|
163 | 163 | |
164 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
165 | - $this->assertEquals( 'U:TESTSUB02', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
166 | - $this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getAttributes() ) ); |
|
164 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
165 | + $this->assertEquals('U:TESTSUB02', $this->object->get()->getProduct(0)->getProductCode()); |
|
166 | + $this->assertEquals(2, count($this->object->get()->getProduct(0)->getAttributes())); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
170 | 170 | public function testAddProductVariantNonUnique() |
171 | 171 | { |
172 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
172 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
173 | 173 | |
174 | 174 | $search = $productManager->createSearch(); |
175 | - $search->setConditions( $search->compare( '==', 'product.code', 'U:TEST' ) ); |
|
175 | + $search->setConditions($search->compare('==', 'product.code', 'U:TEST')); |
|
176 | 176 | |
177 | - $items = $productManager->searchItems( $search, array() ); |
|
177 | + $items = $productManager->searchItems($search, array()); |
|
178 | 178 | |
179 | - if( ( $item = reset( $items ) ) === false ) { |
|
180 | - throw new \Exception( 'Product not found' ); |
|
179 | + if (($item = reset($items)) === false) { |
|
180 | + throw new \Exception('Product not found'); |
|
181 | 181 | } |
182 | 182 | |
183 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
183 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
184 | 184 | |
185 | 185 | $search = $attributeManager->createSearch(); |
186 | 186 | $expr = array( |
187 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
188 | - $search->compare( '==', 'attribute.code', '30' ), |
|
189 | - $search->compare( '==', 'attribute.type.code', 'width' ), |
|
187 | + $search->compare('==', 'attribute.domain', 'product'), |
|
188 | + $search->compare('==', 'attribute.code', '30'), |
|
189 | + $search->compare('==', 'attribute.type.code', 'width'), |
|
190 | 190 | ); |
191 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
191 | + $search->setConditions($search->combine('&&', $expr)); |
|
192 | 192 | |
193 | - $attributes = $attributeManager->searchItems( $search ); |
|
193 | + $attributes = $attributeManager->searchItems($search); |
|
194 | 194 | |
195 | - if( count( $attributes ) === 0 ) { |
|
196 | - throw new \Exception( 'Attributes not found' ); |
|
195 | + if (count($attributes) === 0) { |
|
196 | + throw new \Exception('Attributes not found'); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
200 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
201 | - $this->object->addProduct( $item->getId(), 1, array(), array_keys( $attributes ) ); |
|
200 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
201 | + $this->object->addProduct($item->getId(), 1, array(), array_keys($attributes)); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
205 | 205 | public function testAddProductVariantNotRequired() |
206 | 206 | { |
207 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
207 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
208 | 208 | |
209 | 209 | $search = $attributeManager->createSearch(); |
210 | - $search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) ); |
|
210 | + $search->setConditions($search->compare('==', 'attribute.code', 'xs')); |
|
211 | 211 | |
212 | - $attributes = $attributeManager->searchItems( $search ); |
|
212 | + $attributes = $attributeManager->searchItems($search); |
|
213 | 213 | |
214 | - if( count( $attributes ) === 0 ) { |
|
215 | - throw new \Exception( 'Attribute not found' ); |
|
214 | + if (count($attributes) === 0) { |
|
215 | + throw new \Exception('Attribute not found'); |
|
216 | 216 | } |
217 | 217 | |
218 | - $options = array( 'variant' => false ); |
|
218 | + $options = array('variant' => false); |
|
219 | 219 | |
220 | - $this->object->addProduct( $this->testItem->getId(), 1, $options, array_keys( $attributes ) ); |
|
220 | + $this->object->addProduct($this->testItem->getId(), 1, $options, array_keys($attributes)); |
|
221 | 221 | |
222 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
223 | - $this->assertEquals( 'U:TESTP', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
222 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
223 | + $this->assertEquals('U:TESTP', $this->object->get()->getProduct(0)->getProductCode()); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
227 | 227 | public function testAddProductConfigAttribute() |
228 | 228 | { |
229 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
229 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
230 | 230 | |
231 | 231 | $search = $attributeManager->createSearch(); |
232 | - $search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) ); |
|
232 | + $search->setConditions($search->compare('==', 'attribute.code', 'xs')); |
|
233 | 233 | |
234 | - $attributes = $attributeManager->searchItems( $search ); |
|
234 | + $attributes = $attributeManager->searchItems($search); |
|
235 | 235 | |
236 | - if( empty( $attributes ) ) { |
|
237 | - throw new \Exception( 'Attribute not found' ); |
|
236 | + if (empty($attributes)) { |
|
237 | + throw new \Exception('Attribute not found'); |
|
238 | 238 | } |
239 | 239 | |
240 | - $this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array_keys( $attributes ) ); |
|
240 | + $this->object->addProduct($this->testItem->getId(), 1, array(), array(), array_keys($attributes)); |
|
241 | 241 | $basket = $this->object->get(); |
242 | 242 | |
243 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
244 | - $this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() ); |
|
245 | - $this->assertEquals( 'xs', $basket->getProduct( 0 )->getAttribute( 'size', 'config' ) ); |
|
243 | + $this->assertEquals(1, count($basket->getProducts())); |
|
244 | + $this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode()); |
|
245 | + $this->assertEquals('xs', $basket->getProduct(0)->getAttribute('size', 'config')); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
249 | 249 | public function testAddProductHiddenAttribute() |
250 | 250 | { |
251 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
251 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
252 | 252 | |
253 | 253 | $search = $attributeManager->createSearch(); |
254 | 254 | $expr = array( |
255 | - $search->compare( '==', 'attribute.code', '29' ), |
|
256 | - $search->compare( '==', 'attribute.type.code', 'width' ), |
|
255 | + $search->compare('==', 'attribute.code', '29'), |
|
256 | + $search->compare('==', 'attribute.type.code', 'width'), |
|
257 | 257 | ); |
258 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
258 | + $search->setConditions($search->combine('&&', $expr)); |
|
259 | 259 | |
260 | - $attributes = $attributeManager->searchItems( $search ); |
|
260 | + $attributes = $attributeManager->searchItems($search); |
|
261 | 261 | |
262 | - if( empty( $attributes ) ) { |
|
263 | - throw new \Exception( 'Attribute not found' ); |
|
262 | + if (empty($attributes)) { |
|
263 | + throw new \Exception('Attribute not found'); |
|
264 | 264 | } |
265 | 265 | |
266 | - $this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array(), array_keys( $attributes ) ); |
|
266 | + $this->object->addProduct($this->testItem->getId(), 1, array(), array(), array(), array_keys($attributes)); |
|
267 | 267 | |
268 | 268 | $basket = $this->object->get(); |
269 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
269 | + $this->assertEquals(1, count($basket->getProducts())); |
|
270 | 270 | |
271 | - $product = $basket->getProduct( 0 ); |
|
272 | - $this->assertEquals( 'U:TESTPSUB01', $product->getProductCode() ); |
|
271 | + $product = $basket->getProduct(0); |
|
272 | + $this->assertEquals('U:TESTPSUB01', $product->getProductCode()); |
|
273 | 273 | |
274 | 274 | $attributes = $product->getAttributes(); |
275 | - $this->assertEquals( 1, count( $attributes ) ); |
|
275 | + $this->assertEquals(1, count($attributes)); |
|
276 | 276 | |
277 | - if( ( $attribute = reset( $attributes ) ) === false ) { |
|
278 | - throw new \Exception( 'No attribute' ); |
|
277 | + if (($attribute = reset($attributes)) === false) { |
|
278 | + throw new \Exception('No attribute'); |
|
279 | 279 | } |
280 | 280 | |
281 | - $this->assertEquals( 'hidden', $attribute->getType() ); |
|
282 | - $this->assertEquals( '29', $product->getAttribute( 'width', 'hidden' ) ); |
|
281 | + $this->assertEquals('hidden', $attribute->getType()); |
|
282 | + $this->assertEquals('29', $product->getAttribute('width', 'hidden')); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
286 | 286 | public function testAddProductCustomAttribute() |
287 | 287 | { |
288 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
288 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
289 | 289 | |
290 | 290 | $search = $attributeManager->createSearch(); |
291 | 291 | $expr = array( |
292 | - $search->compare( '==', 'attribute.code', 'custom' ), |
|
293 | - $search->compare( '==', 'attribute.type.code', 'date' ), |
|
292 | + $search->compare('==', 'attribute.code', 'custom'), |
|
293 | + $search->compare('==', 'attribute.type.code', 'date'), |
|
294 | 294 | ); |
295 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
295 | + $search->setConditions($search->combine('&&', $expr)); |
|
296 | 296 | |
297 | - $attributes = $attributeManager->searchItems( $search ); |
|
297 | + $attributes = $attributeManager->searchItems($search); |
|
298 | 298 | |
299 | - if( ( $attrItem = reset( $attributes ) ) === false ) { |
|
300 | - throw new \Exception( 'Attribute not found' ); |
|
299 | + if (($attrItem = reset($attributes)) === false) { |
|
300 | + throw new \Exception('Attribute not found'); |
|
301 | 301 | } |
302 | 302 | |
303 | - $attrValues = array( $attrItem->getId() => '2000-01-01' ); |
|
303 | + $attrValues = array($attrItem->getId() => '2000-01-01'); |
|
304 | 304 | |
305 | - $this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array(), array(), $attrValues ); |
|
305 | + $this->object->addProduct($this->testItem->getId(), 1, array(), array(), array(), array(), $attrValues); |
|
306 | 306 | $basket = $this->object->get(); |
307 | 307 | |
308 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
309 | - $this->assertEquals( '2000-01-01', $basket->getProduct( 0 )->getAttribute( 'date', 'custom' ) ); |
|
308 | + $this->assertEquals(1, count($basket->getProducts())); |
|
309 | + $this->assertEquals('2000-01-01', $basket->getProduct(0)->getAttribute('date', 'custom')); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | |
313 | 313 | public function testAddProductAttributeNotAssigned() |
314 | 314 | { |
315 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
315 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
316 | 316 | |
317 | 317 | $search = $attributeManager->createSearch(); |
318 | 318 | $expr = array( |
319 | - $search->compare( '==', 'attribute.code', '30' ), |
|
320 | - $search->compare( '==', 'attribute.type.code', 'width' ), |
|
319 | + $search->compare('==', 'attribute.code', '30'), |
|
320 | + $search->compare('==', 'attribute.type.code', 'width'), |
|
321 | 321 | ); |
322 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
322 | + $search->setConditions($search->combine('&&', $expr)); |
|
323 | 323 | |
324 | - $attribute = $attributeManager->searchItems( $search ); |
|
324 | + $attribute = $attributeManager->searchItems($search); |
|
325 | 325 | |
326 | - if( empty( $attribute ) ) { |
|
327 | - throw new \Exception( 'Attribute not found' ); |
|
326 | + if (empty($attribute)) { |
|
327 | + throw new \Exception('Attribute not found'); |
|
328 | 328 | } |
329 | 329 | |
330 | - $hiddenAttrIds = array_keys( $attribute ); |
|
331 | - $configAttrIds = array_keys( $attribute ); |
|
330 | + $hiddenAttrIds = array_keys($attribute); |
|
331 | + $configAttrIds = array_keys($attribute); |
|
332 | 332 | |
333 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
334 | - $this->object->addProduct( $this->testItem->getId(), 1, array(), array(), $configAttrIds, $hiddenAttrIds ); |
|
333 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
334 | + $this->object->addProduct($this->testItem->getId(), 1, array(), array(), $configAttrIds, $hiddenAttrIds); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
338 | 338 | public function testAddProductNegativeQuantityException() |
339 | 339 | { |
340 | - $this->setExpectedException( '\\Aimeos\\MShop\\Order\\Exception' ); |
|
341 | - $this->object->addProduct( $this->testItem->getId(), -1 ); |
|
340 | + $this->setExpectedException('\\Aimeos\\MShop\\Order\\Exception'); |
|
341 | + $this->object->addProduct($this->testItem->getId(), -1); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
345 | 345 | public function testAddProductNotEnoughStockException() |
346 | 346 | { |
347 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
347 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
348 | 348 | |
349 | 349 | $search = $productManager->createSearch(); |
350 | - $search->setConditions( $search->compare( '==', 'product.code', 'IJKL' ) ); |
|
350 | + $search->setConditions($search->compare('==', 'product.code', 'IJKL')); |
|
351 | 351 | |
352 | - $items = $productManager->searchItems( $search ); |
|
352 | + $items = $productManager->searchItems($search); |
|
353 | 353 | |
354 | - if( ( $item = reset( $items ) ) === false ) { |
|
355 | - throw new \Exception( 'Product not found' ); |
|
354 | + if (($item = reset($items)) === false) { |
|
355 | + throw new \Exception('Product not found'); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | try |
359 | 359 | { |
360 | - $this->object->addProduct( $item->getId(), 5, array(), array(), array(), array(), array(), 'unit_warehouse3' ); |
|
361 | - throw new \Exception( 'Expected exception not thrown' ); |
|
360 | + $this->object->addProduct($item->getId(), 5, array(), array(), array(), array(), array(), 'unit_warehouse3'); |
|
361 | + throw new \Exception('Expected exception not thrown'); |
|
362 | 362 | } |
363 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
363 | + catch (\Aimeos\Controller\Frontend\Basket\Exception $e) |
|
364 | 364 | { |
365 | - $item = $this->object->get()->getProduct( 0 ); |
|
366 | - $this->assertEquals( 3, $item->getQuantity() ); |
|
365 | + $item = $this->object->get()->getProduct(0); |
|
366 | + $this->assertEquals(3, $item->getQuantity()); |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
370 | 370 | |
371 | 371 | public function testAddProductNoStockException() |
372 | 372 | { |
373 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
373 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
374 | 374 | |
375 | 375 | $search = $productManager->createSearch(); |
376 | - $search->setConditions( $search->compare( '==', 'product.code', 'EFGH' ) ); |
|
376 | + $search->setConditions($search->compare('==', 'product.code', 'EFGH')); |
|
377 | 377 | |
378 | - $items = $productManager->searchItems( $search ); |
|
378 | + $items = $productManager->searchItems($search); |
|
379 | 379 | |
380 | - if( ( $item = reset( $items ) ) === false ) { |
|
381 | - throw new \Exception( 'Product not found' ); |
|
380 | + if (($item = reset($items)) === false) { |
|
381 | + throw new \Exception('Product not found'); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | try |
385 | 385 | { |
386 | - $this->object->addProduct( $item->getId(), 5, array(), array(), array(), array(), array(), 'unit_warehouse2' ); |
|
387 | - throw new \Exception( 'Expected exception not thrown' ); |
|
386 | + $this->object->addProduct($item->getId(), 5, array(), array(), array(), array(), array(), 'unit_warehouse2'); |
|
387 | + throw new \Exception('Expected exception not thrown'); |
|
388 | 388 | } |
389 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
389 | + catch (\Aimeos\Controller\Frontend\Basket\Exception $e) |
|
390 | 390 | { |
391 | - $this->assertEquals( array(), $this->object->get()->getProducts() ); |
|
391 | + $this->assertEquals(array(), $this->object->get()->getProducts()); |
|
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | 395 | |
396 | 396 | public function testAddProductNoStockRequired() |
397 | 397 | { |
398 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
398 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
399 | 399 | |
400 | 400 | $search = $productManager->createSearch(); |
401 | - $search->setConditions( $search->compare( '==', 'product.code', 'IJKL' ) ); |
|
401 | + $search->setConditions($search->compare('==', 'product.code', 'IJKL')); |
|
402 | 402 | |
403 | - $items = $productManager->searchItems( $search ); |
|
403 | + $items = $productManager->searchItems($search); |
|
404 | 404 | |
405 | - if( ( $item = reset( $items ) ) === false ) { |
|
406 | - throw new \Exception( 'Product not found' ); |
|
405 | + if (($item = reset($items)) === false) { |
|
406 | + throw new \Exception('Product not found'); |
|
407 | 407 | } |
408 | 408 | |
409 | - $this->object->addProduct( $item->getId(), 5, array( 'stock' => false ) ); |
|
409 | + $this->object->addProduct($item->getId(), 5, array('stock' => false)); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | |
413 | 413 | public function testAddProductNoStockItem() |
414 | 414 | { |
415 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
415 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
416 | 416 | |
417 | 417 | $search = $productManager->createSearch(); |
418 | - $search->setConditions( $search->compare( '==', 'product.code', 'QRST' ) ); |
|
418 | + $search->setConditions($search->compare('==', 'product.code', 'QRST')); |
|
419 | 419 | |
420 | - $items = $productManager->searchItems( $search ); |
|
420 | + $items = $productManager->searchItems($search); |
|
421 | 421 | |
422 | - if( ( $item = reset( $items ) ) === false ) { |
|
423 | - throw new \Exception( 'Product not found' ); |
|
422 | + if (($item = reset($items)) === false) { |
|
423 | + throw new \Exception('Product not found'); |
|
424 | 424 | } |
425 | 425 | |
426 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
427 | - $this->object->addProduct( $item->getId(), 1 ); |
|
426 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
427 | + $this->object->addProduct($item->getId(), 1); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | |
431 | 431 | public function testAddProductNoPriceException() |
432 | 432 | { |
433 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
433 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
434 | 434 | |
435 | 435 | $search = $productManager->createSearch(); |
436 | - $search->setConditions( $search->compare( '==', 'product.code', 'MNOP' ) ); |
|
436 | + $search->setConditions($search->compare('==', 'product.code', 'MNOP')); |
|
437 | 437 | |
438 | - $items = $productManager->searchItems( $search ); |
|
438 | + $items = $productManager->searchItems($search); |
|
439 | 439 | |
440 | - if( ( $item = reset( $items ) ) === false ) { |
|
441 | - throw new \Exception( 'Product not found' ); |
|
440 | + if (($item = reset($items)) === false) { |
|
441 | + throw new \Exception('Product not found'); |
|
442 | 442 | } |
443 | 443 | |
444 | - $this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' ); |
|
445 | - $this->object->addProduct( $item->getId(), 1 ); |
|
444 | + $this->setExpectedException('\\Aimeos\\MShop\\Price\\Exception'); |
|
445 | + $this->object->addProduct($item->getId(), 1); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | |
449 | 449 | public function testAddProductConfigAttributeException() |
450 | 450 | { |
451 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
452 | - $this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array( -1 ) ); |
|
451 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
452 | + $this->object->addProduct($this->testItem->getId(), 1, array(), array(), array( -1 )); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | |
456 | 456 | public function testAddProductEmptySelectionException() |
457 | 457 | { |
458 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
458 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
459 | 459 | $search = $productManager->createSearch(); |
460 | - $search->setConditions( $search->compare( '==', 'product.code', 'U:noSel' ) ); |
|
461 | - $items = $productManager->searchItems( $search ); |
|
460 | + $search->setConditions($search->compare('==', 'product.code', 'U:noSel')); |
|
461 | + $items = $productManager->searchItems($search); |
|
462 | 462 | |
463 | - if( ( $item = reset( $items ) ) === false ) { |
|
464 | - throw new \Exception( 'Product not found' ); |
|
463 | + if (($item = reset($items)) === false) { |
|
464 | + throw new \Exception('Product not found'); |
|
465 | 465 | } |
466 | 466 | |
467 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
468 | - $this->object->addProduct( $item->getId(), 1 ); |
|
467 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
468 | + $this->object->addProduct($item->getId(), 1); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | |
472 | 472 | public function testAddProductSelectionWithPricelessItem() |
473 | 473 | { |
474 | - $this->object->addProduct( $this->testItem->getId(), 1 ); |
|
474 | + $this->object->addProduct($this->testItem->getId(), 1); |
|
475 | 475 | |
476 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
476 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
477 | 477 | $search = $productManager->createSearch(); |
478 | 478 | |
479 | - $search->setConditions( $search->compare( '==', 'product.code', 'U:TESTPSUB01' ) ); |
|
480 | - $items = $productManager->searchItems( $search ); |
|
479 | + $search->setConditions($search->compare('==', 'product.code', 'U:TESTPSUB01')); |
|
480 | + $items = $productManager->searchItems($search); |
|
481 | 481 | |
482 | - if( ( $item = reset( $items ) ) === false ) { |
|
483 | - throw new \Exception( 'Product not found' ); |
|
482 | + if (($item = reset($items)) === false) { |
|
483 | + throw new \Exception('Product not found'); |
|
484 | 484 | } |
485 | 485 | |
486 | - $this->assertEquals( 'U:TESTPSUB01', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
486 | + $this->assertEquals('U:TESTPSUB01', $this->object->get()->getProduct(0)->getProductCode()); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | |
490 | 490 | public function testAddProductLowQuantityPriceException() |
491 | 491 | { |
492 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
492 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
493 | 493 | $search = $productManager->createSearch(); |
494 | - $search->setConditions( $search->compare( '==', 'product.code', 'IJKL' ) ); |
|
495 | - $items = $productManager->searchItems( $search ); |
|
494 | + $search->setConditions($search->compare('==', 'product.code', 'IJKL')); |
|
495 | + $items = $productManager->searchItems($search); |
|
496 | 496 | |
497 | - if( ( $item = reset( $items ) ) === false ) { |
|
498 | - throw new \Exception( 'Product not found' ); |
|
497 | + if (($item = reset($items)) === false) { |
|
498 | + throw new \Exception('Product not found'); |
|
499 | 499 | } |
500 | 500 | |
501 | - $this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' ); |
|
502 | - $this->object->addProduct( $item->getId(), 1 ); |
|
501 | + $this->setExpectedException('\\Aimeos\\MShop\\Price\\Exception'); |
|
502 | + $this->object->addProduct($item->getId(), 1); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | |
506 | 506 | public function testAddProductHigherQuantities() |
507 | 507 | { |
508 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
508 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
509 | 509 | $search = $productManager->createSearch(); |
510 | - $search->setConditions( $search->compare( '==', 'product.code', 'IJKL' ) ); |
|
511 | - $items = $productManager->searchItems( $search ); |
|
510 | + $search->setConditions($search->compare('==', 'product.code', 'IJKL')); |
|
511 | + $items = $productManager->searchItems($search); |
|
512 | 512 | |
513 | - if( ( $item = reset( $items ) ) === false ) { |
|
514 | - throw new \Exception( 'Product not found' ); |
|
513 | + if (($item = reset($items)) === false) { |
|
514 | + throw new \Exception('Product not found'); |
|
515 | 515 | } |
516 | 516 | |
517 | - $this->object->addProduct( $item->getId(), 2, array(), array(), array(), array(), array(), 'unit_warehouse3' ); |
|
517 | + $this->object->addProduct($item->getId(), 2, array(), array(), array(), array(), array(), 'unit_warehouse3'); |
|
518 | 518 | |
519 | - $this->assertEquals( 2, $this->object->get()->getProduct( 0 )->getQuantity() ); |
|
520 | - $this->assertEquals( 'IJKL', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
519 | + $this->assertEquals(2, $this->object->get()->getProduct(0)->getQuantity()); |
|
520 | + $this->assertEquals('IJKL', $this->object->get()->getProduct(0)->getProductCode()); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
524 | 524 | public function testDeleteProductFlagError() |
525 | 525 | { |
526 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
526 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
527 | 527 | |
528 | - $item = $this->object->get()->getProduct( 0 ); |
|
529 | - $item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ); |
|
528 | + $item = $this->object->get()->getProduct(0); |
|
529 | + $item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE); |
|
530 | 530 | |
531 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
532 | - $this->object->deleteProduct( 0 ); |
|
531 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
532 | + $this->object->deleteProduct(0); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | |
536 | 536 | public function testEditProduct() |
537 | 537 | { |
538 | - $this->object->addProduct( $this->testItem->getId(), 1 ); |
|
538 | + $this->object->addProduct($this->testItem->getId(), 1); |
|
539 | 539 | |
540 | - $item = $this->object->get()->getProduct( 0 ); |
|
541 | - $this->assertEquals( 1, $item->getQuantity() ); |
|
540 | + $item = $this->object->get()->getProduct(0); |
|
541 | + $this->assertEquals(1, $item->getQuantity()); |
|
542 | 542 | |
543 | - $this->object->editProduct( 0, 4 ); |
|
543 | + $this->object->editProduct(0, 4); |
|
544 | 544 | |
545 | - $item = $this->object->get()->getProduct( 0 ); |
|
546 | - $this->assertEquals( 4, $item->getQuantity() ); |
|
547 | - $this->assertEquals( 'U:TESTPSUB01', $item->getProductCode() ); |
|
545 | + $item = $this->object->get()->getProduct(0); |
|
546 | + $this->assertEquals(4, $item->getQuantity()); |
|
547 | + $this->assertEquals('U:TESTPSUB01', $item->getProductCode()); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | |
551 | 551 | public function testEditProductAttributes() |
552 | 552 | { |
553 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
553 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
554 | 554 | $search = $productManager->createSearch(); |
555 | - $search->setConditions( $search->compare( '==', 'product.code', 'U:TESTP' ) ); |
|
556 | - $items = $productManager->searchItems( $search ); |
|
555 | + $search->setConditions($search->compare('==', 'product.code', 'U:TESTP')); |
|
556 | + $items = $productManager->searchItems($search); |
|
557 | 557 | |
558 | - if( ( $item = reset( $items ) ) === false ) { |
|
559 | - throw new \Exception( 'Product not found' ); |
|
558 | + if (($item = reset($items)) === false) { |
|
559 | + throw new \Exception('Product not found'); |
|
560 | 560 | } |
561 | 561 | |
562 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
562 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
563 | 563 | $search = $attributeManager->createSearch(); |
564 | 564 | $conditions = array( |
565 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
566 | - $search->combine( '||', array( |
|
567 | - $search->combine( '&&', array( |
|
568 | - $search->compare( '==', 'attribute.code', 'xs' ), |
|
569 | - $search->compare( '==', 'attribute.type.code', 'size' ), |
|
570 | - ) ), |
|
571 | - $search->combine( '&&', array( |
|
572 | - $search->compare( '==', 'attribute.code', 'white' ), |
|
573 | - $search->compare( '==', 'attribute.type.code', 'color' ), |
|
574 | - ) ), |
|
575 | - ) ) |
|
565 | + $search->compare('==', 'attribute.domain', 'product'), |
|
566 | + $search->combine('||', array( |
|
567 | + $search->combine('&&', array( |
|
568 | + $search->compare('==', 'attribute.code', 'xs'), |
|
569 | + $search->compare('==', 'attribute.type.code', 'size'), |
|
570 | + )), |
|
571 | + $search->combine('&&', array( |
|
572 | + $search->compare('==', 'attribute.code', 'white'), |
|
573 | + $search->compare('==', 'attribute.type.code', 'color'), |
|
574 | + )), |
|
575 | + )) |
|
576 | 576 | ); |
577 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
578 | - $attributes = $attributeManager->searchItems( $search ); |
|
577 | + $search->setConditions($search->combine('&&', $conditions)); |
|
578 | + $attributes = $attributeManager->searchItems($search); |
|
579 | 579 | |
580 | - if( ( $attribute = reset( $attributes ) ) === false ) { |
|
581 | - throw new \Exception( 'No attributes available' ); |
|
580 | + if (($attribute = reset($attributes)) === false) { |
|
581 | + throw new \Exception('No attributes available'); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | |
585 | - $this->object->addProduct( $item->getId(), 1, array(), array(), array_keys( $attributes ) ); |
|
586 | - $this->object->editProduct( 0, 4 ); |
|
585 | + $this->object->addProduct($item->getId(), 1, array(), array(), array_keys($attributes)); |
|
586 | + $this->object->editProduct(0, 4); |
|
587 | 587 | |
588 | - $item = $this->object->get()->getProduct( 0 ); |
|
589 | - $this->assertEquals( 2, count( $item->getAttributes() ) ); |
|
590 | - $this->assertEquals( 4, $item->getQuantity() ); |
|
588 | + $item = $this->object->get()->getProduct(0); |
|
589 | + $this->assertEquals(2, count($item->getAttributes())); |
|
590 | + $this->assertEquals(4, $item->getQuantity()); |
|
591 | 591 | |
592 | 592 | |
593 | - $this->object->editProduct( 0, 3, array(), array( $attribute->getType() ) ); |
|
593 | + $this->object->editProduct(0, 3, array(), array($attribute->getType())); |
|
594 | 594 | |
595 | - $item = $this->object->get()->getProduct( 0 ); |
|
596 | - $this->assertEquals( 3, $item->getQuantity() ); |
|
597 | - $this->assertEquals( 1, count( $item->getAttributes() ) ); |
|
598 | - $this->assertEquals( 'U:TESTPSUB01', $item->getProductCode() ); |
|
595 | + $item = $this->object->get()->getProduct(0); |
|
596 | + $this->assertEquals(3, $item->getQuantity()); |
|
597 | + $this->assertEquals(1, count($item->getAttributes())); |
|
598 | + $this->assertEquals('U:TESTPSUB01', $item->getProductCode()); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | |
602 | 602 | public function testEditProductNotEnoughStock() |
603 | 603 | { |
604 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
604 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
605 | 605 | $search = $productManager->createSearch(); |
606 | - $search->setConditions( $search->compare( '==', 'product.code', 'IJKL' ) ); |
|
607 | - $items = $productManager->searchItems( $search ); |
|
606 | + $search->setConditions($search->compare('==', 'product.code', 'IJKL')); |
|
607 | + $items = $productManager->searchItems($search); |
|
608 | 608 | |
609 | - if( ( $item = reset( $items ) ) === false ) { |
|
610 | - throw new \Exception( 'Product not found' ); |
|
609 | + if (($item = reset($items)) === false) { |
|
610 | + throw new \Exception('Product not found'); |
|
611 | 611 | } |
612 | 612 | |
613 | - $this->object->addProduct( $item->getId(), 2, array(), array(), array(), array(), array(), 'unit_warehouse3' ); |
|
613 | + $this->object->addProduct($item->getId(), 2, array(), array(), array(), array(), array(), 'unit_warehouse3'); |
|
614 | 614 | |
615 | - $item = $this->object->get()->getProduct( 0 ); |
|
616 | - $this->assertEquals( 2, $item->getQuantity() ); |
|
615 | + $item = $this->object->get()->getProduct(0); |
|
616 | + $this->assertEquals(2, $item->getQuantity()); |
|
617 | 617 | |
618 | 618 | try |
619 | 619 | { |
620 | - $this->object->editProduct( 0, 5 ); |
|
621 | - throw new \Exception( 'Expected exception not thrown' ); |
|
620 | + $this->object->editProduct(0, 5); |
|
621 | + throw new \Exception('Expected exception not thrown'); |
|
622 | 622 | } |
623 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
623 | + catch (\Aimeos\Controller\Frontend\Basket\Exception $e) |
|
624 | 624 | { |
625 | - $item = $this->object->get()->getProduct( 0 ); |
|
626 | - $this->assertEquals( 3, $item->getQuantity() ); |
|
627 | - $this->assertEquals( 'IJKL', $item->getProductCode() ); |
|
625 | + $item = $this->object->get()->getProduct(0); |
|
626 | + $this->assertEquals(3, $item->getQuantity()); |
|
627 | + $this->assertEquals('IJKL', $item->getProductCode()); |
|
628 | 628 | } |
629 | 629 | } |
630 | 630 | |
@@ -633,128 +633,128 @@ discard block |
||
633 | 633 | { |
634 | 634 | $context = \TestHelperFrontend::getContext(); |
635 | 635 | |
636 | - $productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
636 | + $productManager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
637 | 637 | $search = $productManager->createSearch(); |
638 | - $search->setConditions( $search->compare( '==', 'product.code', 'IJKL' ) ); |
|
639 | - $items = $productManager->searchItems( $search ); |
|
638 | + $search->setConditions($search->compare('==', 'product.code', 'IJKL')); |
|
639 | + $items = $productManager->searchItems($search); |
|
640 | 640 | |
641 | - if( ( $item = reset( $items ) ) === false ) { |
|
642 | - throw new \Exception( 'Product not found' ); |
|
641 | + if (($item = reset($items)) === false) { |
|
642 | + throw new \Exception('Product not found'); |
|
643 | 643 | } |
644 | 644 | |
645 | - $orderProductManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' ); |
|
645 | + $orderProductManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product'); |
|
646 | 646 | $orderProductItem = $orderProductManager->createItem(); |
647 | - $orderProductItem->copyFrom( $item ); |
|
648 | - $orderProductItem->setQuantity( 2 ); |
|
649 | - $orderProductItem->setWarehouseCode( 'unit_warehouse3' ); |
|
647 | + $orderProductItem->copyFrom($item); |
|
648 | + $orderProductItem->setQuantity(2); |
|
649 | + $orderProductItem->setWarehouseCode('unit_warehouse3'); |
|
650 | 650 | |
651 | - $pos = $this->object->get()->addProduct( $orderProductItem, 1 ); |
|
651 | + $pos = $this->object->get()->addProduct($orderProductItem, 1); |
|
652 | 652 | |
653 | - $item = $this->object->get()->getProduct( $pos ); |
|
654 | - $this->assertEquals( 2, $item->getQuantity() ); |
|
653 | + $item = $this->object->get()->getProduct($pos); |
|
654 | + $this->assertEquals(2, $item->getQuantity()); |
|
655 | 655 | |
656 | 656 | try |
657 | 657 | { |
658 | - $this->object->editProduct( $pos, 5 ); |
|
659 | - throw new \Exception( 'Expected exception not thrown' ); |
|
658 | + $this->object->editProduct($pos, 5); |
|
659 | + throw new \Exception('Expected exception not thrown'); |
|
660 | 660 | } |
661 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
661 | + catch (\Aimeos\Controller\Frontend\Basket\Exception $e) |
|
662 | 662 | { |
663 | - $this->assertEquals( 3, $this->object->get()->getProduct( $pos )->getQuantity() ); |
|
663 | + $this->assertEquals(3, $this->object->get()->getProduct($pos)->getQuantity()); |
|
664 | 664 | } |
665 | 665 | } |
666 | 666 | |
667 | 667 | |
668 | 668 | public function testEditProductStockNotChecked() |
669 | 669 | { |
670 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
670 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
671 | 671 | $search = $productManager->createSearch(); |
672 | - $search->setConditions( $search->compare( '==', 'product.code', 'IJKL' ) ); |
|
673 | - $items = $productManager->searchItems( $search ); |
|
672 | + $search->setConditions($search->compare('==', 'product.code', 'IJKL')); |
|
673 | + $items = $productManager->searchItems($search); |
|
674 | 674 | |
675 | - if( ( $item = reset( $items ) ) === false ) { |
|
676 | - throw new \Exception( 'Product not found' ); |
|
675 | + if (($item = reset($items)) === false) { |
|
676 | + throw new \Exception('Product not found'); |
|
677 | 677 | } |
678 | 678 | |
679 | - $this->object->addProduct( $item->getId(), 2, array(), array(), array(), array(), array(), 'unit_warehouse3' ); |
|
679 | + $this->object->addProduct($item->getId(), 2, array(), array(), array(), array(), array(), 'unit_warehouse3'); |
|
680 | 680 | |
681 | - $item = $this->object->get()->getProduct( 0 ); |
|
682 | - $this->assertEquals( 2, $item->getQuantity() ); |
|
681 | + $item = $this->object->get()->getProduct(0); |
|
682 | + $this->assertEquals(2, $item->getQuantity()); |
|
683 | 683 | |
684 | - $this->object->editProduct( 0, 5, array( 'stock' => false ) ); |
|
684 | + $this->object->editProduct(0, 5, array('stock' => false)); |
|
685 | 685 | |
686 | - $item = $this->object->get()->getProduct( 0 ); |
|
687 | - $this->assertEquals( 5, $item->getQuantity() ); |
|
688 | - $this->assertEquals( 'IJKL', $item->getProductCode() ); |
|
686 | + $item = $this->object->get()->getProduct(0); |
|
687 | + $this->assertEquals(5, $item->getQuantity()); |
|
688 | + $this->assertEquals('IJKL', $item->getProductCode()); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | |
692 | 692 | public function testEditProductFlagError() |
693 | 693 | { |
694 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
694 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
695 | 695 | |
696 | - $item = $this->object->get()->getProduct( 0 ); |
|
697 | - $item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ); |
|
696 | + $item = $this->object->get()->getProduct(0); |
|
697 | + $item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE); |
|
698 | 698 | |
699 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
700 | - $this->object->editProduct( 0, 4 ); |
|
699 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
700 | + $this->object->editProduct(0, 4); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | |
704 | 704 | public function testAddCoupon() |
705 | 705 | { |
706 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
707 | - $this->object->addCoupon( 'GHIJ' ); |
|
706 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
707 | + $this->object->addCoupon('GHIJ'); |
|
708 | 708 | |
709 | 709 | $basket = $this->object->get(); |
710 | 710 | |
711 | - $this->assertEquals( 1, count( $basket->getCoupons() ) ); |
|
711 | + $this->assertEquals(1, count($basket->getCoupons())); |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | |
715 | 715 | public function testAddCouponInvalidCode() |
716 | 716 | { |
717 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
718 | - $this->object->addCoupon( 'invalid' ); |
|
717 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
718 | + $this->object->addCoupon('invalid'); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | |
722 | 722 | public function testAddCouponMissingRequirements() |
723 | 723 | { |
724 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
725 | - $this->object->addCoupon( 'OPQR' ); |
|
724 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
725 | + $this->object->addCoupon('OPQR'); |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | |
729 | 729 | public function testDeleteCoupon() |
730 | 730 | { |
731 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
732 | - $this->object->addCoupon( '90AB' ); |
|
733 | - $this->object->deleteCoupon( '90AB' ); |
|
731 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
732 | + $this->object->addCoupon('90AB'); |
|
733 | + $this->object->deleteCoupon('90AB'); |
|
734 | 734 | |
735 | 735 | $basket = $this->object->get(); |
736 | 736 | |
737 | - $this->assertEquals( 0, count( $basket->getCoupons() ) ); |
|
737 | + $this->assertEquals(0, count($basket->getCoupons())); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
741 | 741 | public function testClear() |
742 | 742 | { |
743 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
743 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
744 | 744 | $this->object->clear(); |
745 | 745 | |
746 | - $this->assertEquals( 0, count( $this->object->get()->getProducts() ) ); |
|
746 | + $this->assertEquals(0, count($this->object->get()->getProducts())); |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | |
750 | 750 | public function testSetBillingAddressByItem() |
751 | 751 | { |
752 | - $item = $this->getAddress( 'Example company' ); |
|
752 | + $item = $this->getAddress('Example company'); |
|
753 | 753 | |
754 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item ); |
|
754 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item); |
|
755 | 755 | |
756 | - $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
757 | - $this->assertEquals( 'Example company', $address->getCompany() ); |
|
756 | + $address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
757 | + $this->assertEquals('Example company', $address->getCompany()); |
|
758 | 758 | } |
759 | 759 | |
760 | 760 | |
@@ -782,37 +782,37 @@ discard block |
||
782 | 782 | 'order.base.address.flag' => 0, |
783 | 783 | ); |
784 | 784 | |
785 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture ); |
|
785 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture); |
|
786 | 786 | |
787 | - $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
788 | - $this->assertEquals( 'Example company', $address->getCompany() ); |
|
789 | - $this->assertEquals( 'Dr.', $address->getTitle() ); |
|
790 | - $this->assertEquals( 'firstunit', $address->getFirstname() ); |
|
787 | + $address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
788 | + $this->assertEquals('Example company', $address->getCompany()); |
|
789 | + $this->assertEquals('Dr.', $address->getTitle()); |
|
790 | + $this->assertEquals('firstunit', $address->getFirstname()); |
|
791 | 791 | } |
792 | 792 | |
793 | 793 | |
794 | 794 | public function testSetBillingAddressByArrayError() |
795 | 795 | { |
796 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
797 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array( 'error' => false ) ); |
|
796 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
797 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array('error' => false)); |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | |
801 | 801 | public function testSetBillingAddressParameterError() |
802 | 802 | { |
803 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
804 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error' ); |
|
803 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
804 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error'); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | |
808 | 808 | public function testSetDeliveryAddressByItem() |
809 | 809 | { |
810 | - $item = $this->getAddress( 'Example company' ); |
|
810 | + $item = $this->getAddress('Example company'); |
|
811 | 811 | |
812 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item ); |
|
812 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item); |
|
813 | 813 | |
814 | - $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY ); |
|
815 | - $this->assertEquals( 'Example company', $address->getCompany() ); |
|
814 | + $address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY); |
|
815 | + $this->assertEquals('Example company', $address->getCompany()); |
|
816 | 816 | } |
817 | 817 | |
818 | 818 | |
@@ -839,113 +839,113 @@ discard block |
||
839 | 839 | 'order.base.address.website' => 'www.example.com', |
840 | 840 | 'order.base.address.flag' => 0, |
841 | 841 | ); |
842 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture ); |
|
842 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture); |
|
843 | 843 | |
844 | - $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY ); |
|
845 | - $this->assertEquals( 'Example company', $address->getCompany() ); |
|
846 | - $this->assertEquals( 'Dr.', $address->getTitle() ); |
|
847 | - $this->assertEquals( 'firstunit', $address->getFirstname() ); |
|
844 | + $address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY); |
|
845 | + $this->assertEquals('Example company', $address->getCompany()); |
|
846 | + $this->assertEquals('Dr.', $address->getTitle()); |
|
847 | + $this->assertEquals('firstunit', $address->getFirstname()); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | |
851 | 851 | public function testSetDeliveryAddressByArrayError() |
852 | 852 | { |
853 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
854 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array( 'error' => false ) ); |
|
853 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
854 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array('error' => false)); |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | |
858 | 858 | public function testSetDeliveryAddressTypeError() |
859 | 859 | { |
860 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
861 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error' ); |
|
860 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
861 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error'); |
|
862 | 862 | } |
863 | 863 | |
864 | 864 | |
865 | 865 | public function testSetServicePayment() |
866 | 866 | { |
867 | - $service = $this->getService( 'unitpaymentcode' ); |
|
867 | + $service = $this->getService('unitpaymentcode'); |
|
868 | 868 | |
869 | - $this->object->setService( 'payment', $service->getId(), array() ); |
|
870 | - $this->assertEquals( 'unitpaymentcode', $this->object->get()->getService( 'payment' )->getCode() ); |
|
869 | + $this->object->setService('payment', $service->getId(), array()); |
|
870 | + $this->assertEquals('unitpaymentcode', $this->object->get()->getService('payment')->getCode()); |
|
871 | 871 | |
872 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
873 | - $this->object->setService( 'payment', $service->getId(), array( 'prepay' => true ) ); |
|
872 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
873 | + $this->object->setService('payment', $service->getId(), array('prepay' => true)); |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | |
877 | 877 | public function testSetDeliveryOption() |
878 | 878 | { |
879 | - $service = $this->getService( 'unitcode' ); |
|
879 | + $service = $this->getService('unitcode'); |
|
880 | 880 | |
881 | - $this->object->setService( 'delivery', $service->getId(), array() ); |
|
882 | - $this->assertEquals( 'unitcode', $this->object->get()->getService( 'delivery' )->getCode() ); |
|
881 | + $this->object->setService('delivery', $service->getId(), array()); |
|
882 | + $this->assertEquals('unitcode', $this->object->get()->getService('delivery')->getCode()); |
|
883 | 883 | |
884 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
885 | - $this->object->setService( 'delivery', $service->getId(), array( 'fast shipping' => true, 'air shipping' => false ) ); |
|
884 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
885 | + $this->object->setService('delivery', $service->getId(), array('fast shipping' => true, 'air shipping' => false)); |
|
886 | 886 | } |
887 | 887 | |
888 | 888 | |
889 | 889 | public function testCheckLocale() |
890 | 890 | { |
891 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
892 | - $this->object->addCoupon( 'OPQR' ); |
|
891 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
892 | + $this->object->addCoupon('OPQR'); |
|
893 | 893 | |
894 | - $this->object->setService( 'payment', $this->getService( 'unitpaymentcode' )->getId() ); |
|
895 | - $this->object->setService( 'delivery', $this->getService( 'unitcode' )->getId() ); |
|
894 | + $this->object->setService('payment', $this->getService('unitpaymentcode')->getId()); |
|
895 | + $this->object->setService('delivery', $this->getService('unitcode')->getId()); |
|
896 | 896 | |
897 | 897 | $basket = $this->object->get(); |
898 | 898 | $price = $basket->getPrice(); |
899 | 899 | |
900 | - foreach( $basket->getProducts() as $product ) |
|
900 | + foreach ($basket->getProducts() as $product) |
|
901 | 901 | { |
902 | - $this->assertEquals( 2, $product->getQuantity() ); |
|
903 | - $product->getPrice()->setCurrencyId( 'CHF' ); |
|
902 | + $this->assertEquals(2, $product->getQuantity()); |
|
903 | + $product->getPrice()->setCurrencyId('CHF'); |
|
904 | 904 | } |
905 | 905 | |
906 | - $basket->getService( 'delivery' )->getPrice()->setCurrencyId( 'CHF' ); |
|
907 | - $basket->getService( 'payment' )->getPrice()->setCurrencyId( 'CHF' ); |
|
908 | - $basket->getLocale()->setCurrencyId( 'CHF' ); |
|
909 | - $price->setCurrencyId( 'CHF' ); |
|
906 | + $basket->getService('delivery')->getPrice()->setCurrencyId('CHF'); |
|
907 | + $basket->getService('payment')->getPrice()->setCurrencyId('CHF'); |
|
908 | + $basket->getLocale()->setCurrencyId('CHF'); |
|
909 | + $price->setCurrencyId('CHF'); |
|
910 | 910 | |
911 | - $this->context->getLocale()->setCurrencyId( 'CHF' ); |
|
912 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress( 'Example company' ) ); |
|
911 | + $this->context->getLocale()->setCurrencyId('CHF'); |
|
912 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress('Example company')); |
|
913 | 913 | |
914 | - $this->context->getSession()->set( 'aimeos/basket/currency', 'CHF' ); |
|
915 | - $this->context->getLocale()->setCurrencyId( 'EUR' ); |
|
914 | + $this->context->getSession()->set('aimeos/basket/currency', 'CHF'); |
|
915 | + $this->context->getLocale()->setCurrencyId('EUR'); |
|
916 | 916 | |
917 | - $this->context->getSession()->set( 'aimeos/basket/content-unittest-en-EUR-', null ); |
|
917 | + $this->context->getSession()->set('aimeos/basket/content-unittest-en-EUR-', null); |
|
918 | 918 | |
919 | - $object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
|
919 | + $object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context); |
|
920 | 920 | $basket = $object->get(); |
921 | 921 | |
922 | - foreach( $basket->getProducts() as $product ) |
|
922 | + foreach ($basket->getProducts() as $product) |
|
923 | 923 | { |
924 | - $this->assertEquals( 'EUR', $product->getPrice()->getCurrencyId() ); |
|
925 | - $this->assertEquals( 2, $product->getQuantity() ); |
|
924 | + $this->assertEquals('EUR', $product->getPrice()->getCurrencyId()); |
|
925 | + $this->assertEquals(2, $product->getQuantity()); |
|
926 | 926 | } |
927 | 927 | |
928 | - $this->assertEquals( 'EUR', $basket->getService( 'payment' )->getPrice()->getCurrencyId() ); |
|
929 | - $this->assertEquals( 'EUR', $basket->getService( 'delivery' )->getPrice()->getCurrencyId() ); |
|
930 | - $this->assertEquals( 'EUR', $basket->getLocale()->getCurrencyId() ); |
|
931 | - $this->assertEquals( 'EUR', $basket->getPrice()->getCurrencyId() ); |
|
928 | + $this->assertEquals('EUR', $basket->getService('payment')->getPrice()->getCurrencyId()); |
|
929 | + $this->assertEquals('EUR', $basket->getService('delivery')->getPrice()->getCurrencyId()); |
|
930 | + $this->assertEquals('EUR', $basket->getLocale()->getCurrencyId()); |
|
931 | + $this->assertEquals('EUR', $basket->getPrice()->getCurrencyId()); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | |
935 | 935 | /** |
936 | 936 | * @param string $company |
937 | 937 | */ |
938 | - protected function getAddress( $company ) |
|
938 | + protected function getAddress($company) |
|
939 | 939 | { |
940 | - $customer = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelperFrontend::getContext(), 'Standard' ); |
|
941 | - $addressManager = $customer->getSubManager( 'address', 'Standard' ); |
|
940 | + $customer = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelperFrontend::getContext(), 'Standard'); |
|
941 | + $addressManager = $customer->getSubManager('address', 'Standard'); |
|
942 | 942 | |
943 | 943 | $search = $addressManager->createSearch(); |
944 | - $search->setConditions( $search->compare( '==', 'customer.address.company', $company ) ); |
|
945 | - $items = $addressManager->searchItems( $search ); |
|
944 | + $search->setConditions($search->compare('==', 'customer.address.company', $company)); |
|
945 | + $items = $addressManager->searchItems($search); |
|
946 | 946 | |
947 | - if( ( $item = reset( $items ) ) === false ) { |
|
948 | - throw new \Exception( sprintf( 'No address item with company "%1$s" found', $company ) ); |
|
947 | + if (($item = reset($items)) === false) { |
|
948 | + throw new \Exception(sprintf('No address item with company "%1$s" found', $company)); |
|
949 | 949 | } |
950 | 950 | |
951 | 951 | return $item; |
@@ -955,17 +955,17 @@ discard block |
||
955 | 955 | /** |
956 | 956 | * @param string $code |
957 | 957 | */ |
958 | - protected function getService( $code ) |
|
958 | + protected function getService($code) |
|
959 | 959 | { |
960 | - $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
960 | + $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
961 | 961 | |
962 | 962 | $search = $serviceManager->createSearch(); |
963 | - $search->setConditions( $search->compare( '==', 'service.code', $code ) ); |
|
963 | + $search->setConditions($search->compare('==', 'service.code', $code)); |
|
964 | 964 | |
965 | - $result = $serviceManager->searchItems( $search, array( 'text' ) ); |
|
965 | + $result = $serviceManager->searchItems($search, array('text')); |
|
966 | 966 | |
967 | - if( ( $item = reset( $result ) ) === false ) { |
|
968 | - throw new \Exception( sprintf( 'No service item with code "%1$s" found', $code ) ); |
|
967 | + if (($item = reset($result)) === false) { |
|
968 | + throw new \Exception(sprintf('No service item with code "%1$s" found', $code)); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | return $item; |
@@ -359,8 +359,7 @@ discard block |
||
359 | 359 | { |
360 | 360 | $this->object->addProduct( $item->getId(), 5, array(), array(), array(), array(), array(), 'unit_warehouse3' ); |
361 | 361 | throw new \Exception( 'Expected exception not thrown' ); |
362 | - } |
|
363 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
362 | + } catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
364 | 363 | { |
365 | 364 | $item = $this->object->get()->getProduct( 0 ); |
366 | 365 | $this->assertEquals( 3, $item->getQuantity() ); |
@@ -385,8 +384,7 @@ discard block |
||
385 | 384 | { |
386 | 385 | $this->object->addProduct( $item->getId(), 5, array(), array(), array(), array(), array(), 'unit_warehouse2' ); |
387 | 386 | throw new \Exception( 'Expected exception not thrown' ); |
388 | - } |
|
389 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
387 | + } catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
390 | 388 | { |
391 | 389 | $this->assertEquals( array(), $this->object->get()->getProducts() ); |
392 | 390 | } |
@@ -619,8 +617,7 @@ discard block |
||
619 | 617 | { |
620 | 618 | $this->object->editProduct( 0, 5 ); |
621 | 619 | throw new \Exception( 'Expected exception not thrown' ); |
622 | - } |
|
623 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
620 | + } catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
624 | 621 | { |
625 | 622 | $item = $this->object->get()->getProduct( 0 ); |
626 | 623 | $this->assertEquals( 3, $item->getQuantity() ); |
@@ -657,8 +654,7 @@ discard block |
||
657 | 654 | { |
658 | 655 | $this->object->editProduct( $pos, 5 ); |
659 | 656 | throw new \Exception( 'Expected exception not thrown' ); |
660 | - } |
|
661 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
657 | + } catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
662 | 658 | { |
663 | 659 | $this->assertEquals( 3, $this->object->get()->getProduct( $pos )->getQuantity() ); |
664 | 660 | } |