@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param \Aimeos\MShop\Context\Item\Iface $context Common MShop context object |
30 | 30 | */ |
31 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
31 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
32 | 32 | { |
33 | 33 | $this->context = $context; |
34 | 34 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param array $param List of method parameter |
42 | 42 | * @return boolean Returns always false |
43 | 43 | */ |
44 | - public function __call( $name, array $param ) |
|
44 | + public function __call($name, array $param) |
|
45 | 45 | { |
46 | 46 | return false; |
47 | 47 | } |
@@ -17,92 +17,92 @@ |
||
17 | 17 | { |
18 | 18 | public function testCreateController() |
19 | 19 | { |
20 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket' ); |
|
21 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Frontend\\Iface', $controller ); |
|
20 | + $controller = \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket'); |
|
21 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Frontend\\Iface', $controller); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | public function testCreateControllerEmpty() |
26 | 26 | { |
27 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
28 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), "\t\n" ); |
|
27 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
28 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), "\t\n"); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | public function testCreateControllerInvalidName() |
33 | 33 | { |
34 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
35 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
34 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
35 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), '%^'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testCreateControllerNotExisting() |
40 | 40 | { |
41 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
42 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
41 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
42 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | public function testCreateSubControllerNotExisting() |
47 | 47 | { |
48 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
49 | - \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket/notexist' ); |
|
48 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
49 | + \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket/notexist'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testClear() |
54 | 54 | { |
55 | - $cache = \Aimeos\Controller\Frontend\Factory::setCache( true ); |
|
55 | + $cache = \Aimeos\Controller\Frontend\Factory::setCache(true); |
|
56 | 56 | |
57 | 57 | $context = \TestHelperFrontend::getContext(); |
58 | 58 | |
59 | - $controller1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
59 | + $controller1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
60 | 60 | \Aimeos\Controller\Frontend\Factory::clear(); |
61 | - $controller2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
61 | + $controller2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
62 | 62 | |
63 | - \Aimeos\Controller\Frontend\Factory::setCache( $cache ); |
|
63 | + \Aimeos\Controller\Frontend\Factory::setCache($cache); |
|
64 | 64 | |
65 | - $this->assertNotSame( $controller1, $controller2 ); |
|
65 | + $this->assertNotSame($controller1, $controller2); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testClearSite() |
70 | 70 | { |
71 | - $cache = \Aimeos\Controller\Frontend\Factory::setCache( true ); |
|
71 | + $cache = \Aimeos\Controller\Frontend\Factory::setCache(true); |
|
72 | 72 | |
73 | 73 | $context = \TestHelperFrontend::getContext(); |
74 | 74 | |
75 | - $basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
76 | - $catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
77 | - \Aimeos\Controller\Frontend\Factory::clear( (string) $context ); |
|
75 | + $basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
76 | + $catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
77 | + \Aimeos\Controller\Frontend\Factory::clear((string) $context); |
|
78 | 78 | |
79 | - $basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
80 | - $catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
79 | + $basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
80 | + $catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
81 | 81 | |
82 | - \Aimeos\Controller\Frontend\Factory::setCache( $cache ); |
|
82 | + \Aimeos\Controller\Frontend\Factory::setCache($cache); |
|
83 | 83 | |
84 | - $this->assertNotSame( $basket1, $basket2 ); |
|
85 | - $this->assertNotSame( $catalog1, $catalog2 ); |
|
84 | + $this->assertNotSame($basket1, $basket2); |
|
85 | + $this->assertNotSame($catalog1, $catalog2); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | 89 | public function testClearSpecific() |
90 | 90 | { |
91 | - $cache = \Aimeos\Controller\Frontend\Factory::setCache( true ); |
|
91 | + $cache = \Aimeos\Controller\Frontend\Factory::setCache(true); |
|
92 | 92 | |
93 | 93 | $context = \TestHelperFrontend::getContext(); |
94 | 94 | |
95 | - $basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
96 | - $catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
97 | - \Aimeos\Controller\Frontend\Factory::clear( (string) $context, 'basket' ); |
|
95 | + $basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
96 | + $catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
97 | + \Aimeos\Controller\Frontend\Factory::clear((string) $context, 'basket'); |
|
98 | 98 | |
99 | - $basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
100 | - $catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
99 | + $basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
100 | + $catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
101 | 101 | |
102 | - \Aimeos\Controller\Frontend\Factory::setCache( $cache ); |
|
102 | + \Aimeos\Controller\Frontend\Factory::setCache($cache); |
|
103 | 103 | |
104 | - $this->assertNotSame( $basket1, $basket2 ); |
|
105 | - $this->assertSame( $catalog1, $catalog2 ); |
|
104 | + $this->assertNotSame($basket1, $basket2); |
|
105 | + $this->assertSame($catalog1, $catalog2); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | } |
109 | 109 | \ No newline at end of file |
@@ -12,35 +12,35 @@ |
||
12 | 12 | protected function setUp() |
13 | 13 | { |
14 | 14 | $this->context = \TestHelperFrontend::getContext(); |
15 | - $object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
|
16 | - $this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category( $object, $this->context ); |
|
15 | + $object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context); |
|
16 | + $this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category($object, $this->context); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
20 | 20 | protected function tearDown() |
21 | 21 | { |
22 | 22 | $this->object->clear(); |
23 | - $this->context->getSession()->set( 'aimeos', array() ); |
|
23 | + $this->context->getSession()->set('aimeos', array()); |
|
24 | 24 | |
25 | - unset( $this->object ); |
|
25 | + unset($this->object); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | 29 | public function testAddProductWithCategory() |
30 | 30 | { |
31 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
32 | - $item = $manager->findItem( 'CNE' ); |
|
31 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
32 | + $item = $manager->findItem('CNE'); |
|
33 | 33 | |
34 | - $this->object->addProduct( $item->getId(), 5 ); |
|
34 | + $this->object->addProduct($item->getId(), 5); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testAddProductNoCategory() |
39 | 39 | { |
40 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
41 | - $item = $manager->findItem( 'ABCD' ); |
|
40 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
41 | + $item = $manager->findItem('ABCD'); |
|
42 | 42 | |
43 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Basket\Exception' ); |
|
44 | - $this->object->addProduct( $item->getId(), 5 ); |
|
43 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Basket\Exception'); |
|
44 | + $this->object->addProduct($item->getId(), 5); |
|
45 | 45 | } |
46 | 46 | } |
@@ -41,26 +41,26 @@ |
||
41 | 41 | * @param string $warehouse Unique code of the warehouse to deliver the products from |
42 | 42 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
43 | 43 | */ |
44 | - public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
44 | + public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
45 | 45 | array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(), |
46 | - $warehouse = 'default' ) |
|
46 | + $warehouse = 'default') |
|
47 | 47 | { |
48 | - $catalogListManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' ); |
|
48 | + $catalogListManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists'); |
|
49 | 49 | |
50 | - $search = $catalogListManager->createSearch( true ); |
|
50 | + $search = $catalogListManager->createSearch(true); |
|
51 | 51 | $expr = array( |
52 | - $search->compare( '==', 'catalog.lists.refid', $prodid ), |
|
52 | + $search->compare('==', 'catalog.lists.refid', $prodid), |
|
53 | 53 | $search->getConditions() |
54 | 54 | ); |
55 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
56 | - $search->setSlice( 0, 1 ); |
|
55 | + $search->setConditions($search->combine('&&', $expr)); |
|
56 | + $search->setSlice(0, 1); |
|
57 | 57 | |
58 | - $result = $catalogListManager->searchItems( $search ); |
|
58 | + $result = $catalogListManager->searchItems($search); |
|
59 | 59 | |
60 | - if( reset( $result ) === false ) |
|
60 | + if (reset($result) === false) |
|
61 | 61 | { |
62 | - $msg = sprintf( 'Adding product with ID "%1$s" is not allowed', $prodid ); |
|
63 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
62 | + $msg = sprintf('Adding product with ID "%1$s" is not allowed', $prodid); |
|
63 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $this->getController()->addProduct( |
@@ -18,18 +18,18 @@ discard block |
||
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | 20 | $this->context = \TestHelperFrontend::getContext(); |
21 | - $this->testItem = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' ); |
|
21 | + $this->testItem = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP'); |
|
22 | 22 | |
23 | - $this->object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
|
23 | + $this->object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | protected function tearDown() |
28 | 28 | { |
29 | 29 | $this->object->clear(); |
30 | - $this->context->getSession()->set( 'aimeos', array() ); |
|
30 | + $this->context->getSession()->set('aimeos', array()); |
|
31 | 31 | |
32 | - unset( $this->object, $this->testItem ); |
|
32 | + unset($this->object, $this->testItem); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -38,455 +38,455 @@ discard block |
||
38 | 38 | $basket = $this->object->get(); |
39 | 39 | |
40 | 40 | |
41 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
41 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
42 | 42 | |
43 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
44 | - $this->assertEquals( 2, $basket->getProduct( 0 )->getQuantity() ); |
|
45 | - $this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() ); |
|
43 | + $this->assertEquals(1, count($basket->getProducts())); |
|
44 | + $this->assertEquals(2, $basket->getProduct(0)->getQuantity()); |
|
45 | + $this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode()); |
|
46 | 46 | |
47 | 47 | |
48 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
48 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
49 | 49 | |
50 | - $this->object->addProduct( $item->getId(), 2, array(), array(), array(), array(), array(), 'default' ); |
|
51 | - $item2 = $this->object->get()->getProduct( 1 ); |
|
52 | - $this->object->deleteProduct( 0 ); |
|
50 | + $this->object->addProduct($item->getId(), 2, array(), array(), array(), array(), array(), 'default'); |
|
51 | + $item2 = $this->object->get()->getProduct(1); |
|
52 | + $this->object->deleteProduct(0); |
|
53 | 53 | |
54 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
55 | - $this->assertEquals( $item2, $basket->getProduct( 1 ) ); |
|
56 | - $this->assertEquals( 'CNC', $basket->getProduct( 1 )->getProductCode() ); |
|
54 | + $this->assertEquals(1, count($basket->getProducts())); |
|
55 | + $this->assertEquals($item2, $basket->getProduct(1)); |
|
56 | + $this->assertEquals('CNC', $basket->getProduct(1)->getProductCode()); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | public function testAddProductBundle() |
61 | 61 | { |
62 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:BUNDLE' ); |
|
62 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:BUNDLE'); |
|
63 | 63 | |
64 | - $this->object->addProduct( $item->getId(), 1 ); |
|
64 | + $this->object->addProduct($item->getId(), 1); |
|
65 | 65 | |
66 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
67 | - $this->assertEquals( 'U:BUNDLE', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
68 | - $this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getProducts() ) ); |
|
66 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
67 | + $this->assertEquals('U:BUNDLE', $this->object->get()->getProduct(0)->getProductCode()); |
|
68 | + $this->assertEquals(2, count($this->object->get()->getProduct(0)->getProducts())); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | 72 | public function testAddProductVariant() |
73 | 73 | { |
74 | - $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
74 | + $attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
75 | 75 | |
76 | 76 | $search = $attributeManager->createSearch(); |
77 | - $search->setConditions( $search->compare( '==', 'attribute.code', array( 'xs', 'white' ) ) ); |
|
77 | + $search->setConditions($search->compare('==', 'attribute.code', array('xs', 'white'))); |
|
78 | 78 | |
79 | - $attributes = $attributeManager->searchItems( $search ); |
|
79 | + $attributes = $attributeManager->searchItems($search); |
|
80 | 80 | |
81 | - if( count( $attributes ) === 0 ) { |
|
82 | - throw new \Exception( 'Attributes not found' ); |
|
81 | + if (count($attributes) === 0) { |
|
82 | + throw new \Exception('Attributes not found'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
86 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
86 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
87 | 87 | |
88 | - $this->object->addProduct( $item->getId(), 1, array(), array_keys( $attributes ), array(), array(), array(), 'default' ); |
|
88 | + $this->object->addProduct($item->getId(), 1, array(), array_keys($attributes), array(), array(), array(), 'default'); |
|
89 | 89 | |
90 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
91 | - $this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
90 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
91 | + $this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
95 | 95 | public function testAddProductVariantIncomplete() |
96 | 96 | { |
97 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
97 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
98 | 98 | |
99 | 99 | $search = $attributeManager->createSearch(); |
100 | 100 | $expr = array( |
101 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
102 | - $search->compare( '==', 'attribute.code', '30' ), |
|
103 | - $search->compare( '==', 'attribute.type.code', 'length' ), |
|
101 | + $search->compare('==', 'attribute.domain', 'product'), |
|
102 | + $search->compare('==', 'attribute.code', '30'), |
|
103 | + $search->compare('==', 'attribute.type.code', 'length'), |
|
104 | 104 | ); |
105 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
105 | + $search->setConditions($search->combine('&&', $expr)); |
|
106 | 106 | |
107 | - $attributes = $attributeManager->searchItems( $search ); |
|
107 | + $attributes = $attributeManager->searchItems($search); |
|
108 | 108 | |
109 | - if( count( $attributes ) === 0 ) { |
|
110 | - throw new \Exception( 'Attributes not found' ); |
|
109 | + if (count($attributes) === 0) { |
|
110 | + throw new \Exception('Attributes not found'); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
114 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' ); |
|
114 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST'); |
|
115 | 115 | |
116 | - $this->object->addProduct( $item->getId(), 1, array(), array_keys( $attributes ) ); |
|
116 | + $this->object->addProduct($item->getId(), 1, array(), array_keys($attributes)); |
|
117 | 117 | |
118 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
119 | - $this->assertEquals( 'U:TESTSUB02', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
120 | - $this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getAttributes() ) ); |
|
118 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
119 | + $this->assertEquals('U:TESTSUB02', $this->object->get()->getProduct(0)->getProductCode()); |
|
120 | + $this->assertEquals(2, count($this->object->get()->getProduct(0)->getAttributes())); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | |
124 | 124 | public function testAddProductVariantNonUnique() |
125 | 125 | { |
126 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
126 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
127 | 127 | |
128 | 128 | $search = $attributeManager->createSearch(); |
129 | 129 | $expr = array( |
130 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
131 | - $search->compare( '==', 'attribute.code', '30' ), |
|
132 | - $search->compare( '==', 'attribute.type.code', 'width' ), |
|
130 | + $search->compare('==', 'attribute.domain', 'product'), |
|
131 | + $search->compare('==', 'attribute.code', '30'), |
|
132 | + $search->compare('==', 'attribute.type.code', 'width'), |
|
133 | 133 | ); |
134 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
134 | + $search->setConditions($search->combine('&&', $expr)); |
|
135 | 135 | |
136 | - $attributes = $attributeManager->searchItems( $search ); |
|
136 | + $attributes = $attributeManager->searchItems($search); |
|
137 | 137 | |
138 | - if( count( $attributes ) === 0 ) { |
|
139 | - throw new \Exception( 'Attributes not found' ); |
|
138 | + if (count($attributes) === 0) { |
|
139 | + throw new \Exception('Attributes not found'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' ); |
|
143 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST'); |
|
144 | 144 | |
145 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
146 | - $this->object->addProduct( $item->getId(), 1, array(), array_keys( $attributes ) ); |
|
145 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
146 | + $this->object->addProduct($item->getId(), 1, array(), array_keys($attributes)); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
150 | 150 | public function testAddProductVariantNotRequired() |
151 | 151 | { |
152 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
152 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
153 | 153 | |
154 | 154 | $search = $attributeManager->createSearch(); |
155 | - $search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) ); |
|
155 | + $search->setConditions($search->compare('==', 'attribute.code', 'xs')); |
|
156 | 156 | |
157 | - $attributes = $attributeManager->searchItems( $search ); |
|
157 | + $attributes = $attributeManager->searchItems($search); |
|
158 | 158 | |
159 | - if( count( $attributes ) === 0 ) { |
|
160 | - throw new \Exception( 'Attribute not found' ); |
|
159 | + if (count($attributes) === 0) { |
|
160 | + throw new \Exception('Attribute not found'); |
|
161 | 161 | } |
162 | 162 | |
163 | - $options = array( 'variant' => false ); |
|
163 | + $options = array('variant' => false); |
|
164 | 164 | |
165 | - $this->object->addProduct( $this->testItem->getId(), 1, $options, array_keys( $attributes ) ); |
|
165 | + $this->object->addProduct($this->testItem->getId(), 1, $options, array_keys($attributes)); |
|
166 | 166 | |
167 | - $this->assertEquals( 1, count( $this->object->get()->getProducts() ) ); |
|
168 | - $this->assertEquals( 'U:TESTP', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
167 | + $this->assertEquals(1, count($this->object->get()->getProducts())); |
|
168 | + $this->assertEquals('U:TESTP', $this->object->get()->getProduct(0)->getProductCode()); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
172 | 172 | public function testAddProductConfigAttribute() |
173 | 173 | { |
174 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
174 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
175 | 175 | |
176 | 176 | $search = $attributeManager->createSearch(); |
177 | - $search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) ); |
|
177 | + $search->setConditions($search->compare('==', 'attribute.code', 'xs')); |
|
178 | 178 | |
179 | - $attributes = $attributeManager->searchItems( $search ); |
|
179 | + $attributes = $attributeManager->searchItems($search); |
|
180 | 180 | |
181 | - if( empty( $attributes ) ) { |
|
182 | - throw new \Exception( 'Attribute not found' ); |
|
181 | + if (empty($attributes)) { |
|
182 | + throw new \Exception('Attribute not found'); |
|
183 | 183 | } |
184 | 184 | |
185 | - $this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array_keys( $attributes ) ); |
|
185 | + $this->object->addProduct($this->testItem->getId(), 1, array(), array(), array_keys($attributes)); |
|
186 | 186 | $basket = $this->object->get(); |
187 | 187 | |
188 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
189 | - $this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() ); |
|
190 | - $this->assertEquals( 'xs', $basket->getProduct( 0 )->getAttribute( 'size', 'config' ) ); |
|
188 | + $this->assertEquals(1, count($basket->getProducts())); |
|
189 | + $this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode()); |
|
190 | + $this->assertEquals('xs', $basket->getProduct(0)->getAttribute('size', 'config')); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
194 | 194 | public function testAddProductHiddenAttribute() |
195 | 195 | { |
196 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
196 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
197 | 197 | |
198 | 198 | $search = $attributeManager->createSearch(); |
199 | 199 | $expr = array( |
200 | - $search->compare( '==', 'attribute.code', '29' ), |
|
201 | - $search->compare( '==', 'attribute.type.code', 'width' ), |
|
200 | + $search->compare('==', 'attribute.code', '29'), |
|
201 | + $search->compare('==', 'attribute.type.code', 'width'), |
|
202 | 202 | ); |
203 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
203 | + $search->setConditions($search->combine('&&', $expr)); |
|
204 | 204 | |
205 | - $attributes = $attributeManager->searchItems( $search ); |
|
205 | + $attributes = $attributeManager->searchItems($search); |
|
206 | 206 | |
207 | - if( empty( $attributes ) ) { |
|
208 | - throw new \Exception( 'Attribute not found' ); |
|
207 | + if (empty($attributes)) { |
|
208 | + throw new \Exception('Attribute not found'); |
|
209 | 209 | } |
210 | 210 | |
211 | - $this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array(), array_keys( $attributes ) ); |
|
211 | + $this->object->addProduct($this->testItem->getId(), 1, array(), array(), array(), array_keys($attributes)); |
|
212 | 212 | |
213 | 213 | $basket = $this->object->get(); |
214 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
214 | + $this->assertEquals(1, count($basket->getProducts())); |
|
215 | 215 | |
216 | - $product = $basket->getProduct( 0 ); |
|
217 | - $this->assertEquals( 'U:TESTPSUB01', $product->getProductCode() ); |
|
216 | + $product = $basket->getProduct(0); |
|
217 | + $this->assertEquals('U:TESTPSUB01', $product->getProductCode()); |
|
218 | 218 | |
219 | 219 | $attributes = $product->getAttributes(); |
220 | - $this->assertEquals( 1, count( $attributes ) ); |
|
220 | + $this->assertEquals(1, count($attributes)); |
|
221 | 221 | |
222 | - if( ( $attribute = reset( $attributes ) ) === false ) { |
|
223 | - throw new \Exception( 'No attribute' ); |
|
222 | + if (($attribute = reset($attributes)) === false) { |
|
223 | + throw new \Exception('No attribute'); |
|
224 | 224 | } |
225 | 225 | |
226 | - $this->assertEquals( 'hidden', $attribute->getType() ); |
|
227 | - $this->assertEquals( '29', $product->getAttribute( 'width', 'hidden' ) ); |
|
226 | + $this->assertEquals('hidden', $attribute->getType()); |
|
227 | + $this->assertEquals('29', $product->getAttribute('width', 'hidden')); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | |
231 | 231 | public function testAddProductCustomAttribute() |
232 | 232 | { |
233 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
233 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
234 | 234 | |
235 | 235 | $search = $attributeManager->createSearch(); |
236 | 236 | $expr = array( |
237 | - $search->compare( '==', 'attribute.code', 'custom' ), |
|
238 | - $search->compare( '==', 'attribute.type.code', 'date' ), |
|
237 | + $search->compare('==', 'attribute.code', 'custom'), |
|
238 | + $search->compare('==', 'attribute.type.code', 'date'), |
|
239 | 239 | ); |
240 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
240 | + $search->setConditions($search->combine('&&', $expr)); |
|
241 | 241 | |
242 | - $attributes = $attributeManager->searchItems( $search ); |
|
242 | + $attributes = $attributeManager->searchItems($search); |
|
243 | 243 | |
244 | - if( ( $attrItem = reset( $attributes ) ) === false ) { |
|
245 | - throw new \Exception( 'Attribute not found' ); |
|
244 | + if (($attrItem = reset($attributes)) === false) { |
|
245 | + throw new \Exception('Attribute not found'); |
|
246 | 246 | } |
247 | 247 | |
248 | - $attrValues = array( $attrItem->getId() => '2000-01-01' ); |
|
248 | + $attrValues = array($attrItem->getId() => '2000-01-01'); |
|
249 | 249 | |
250 | - $this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array(), array(), $attrValues ); |
|
250 | + $this->object->addProduct($this->testItem->getId(), 1, array(), array(), array(), array(), $attrValues); |
|
251 | 251 | $basket = $this->object->get(); |
252 | 252 | |
253 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
254 | - $this->assertEquals( '2000-01-01', $basket->getProduct( 0 )->getAttribute( 'date', 'custom' ) ); |
|
253 | + $this->assertEquals(1, count($basket->getProducts())); |
|
254 | + $this->assertEquals('2000-01-01', $basket->getProduct(0)->getAttribute('date', 'custom')); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
258 | 258 | public function testAddProductAttributeNotAssigned() |
259 | 259 | { |
260 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
260 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
261 | 261 | |
262 | 262 | $search = $attributeManager->createSearch(); |
263 | 263 | $expr = array( |
264 | - $search->compare( '==', 'attribute.code', '30' ), |
|
265 | - $search->compare( '==', 'attribute.type.code', 'width' ), |
|
264 | + $search->compare('==', 'attribute.code', '30'), |
|
265 | + $search->compare('==', 'attribute.type.code', 'width'), |
|
266 | 266 | ); |
267 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
267 | + $search->setConditions($search->combine('&&', $expr)); |
|
268 | 268 | |
269 | - $attribute = $attributeManager->searchItems( $search ); |
|
269 | + $attribute = $attributeManager->searchItems($search); |
|
270 | 270 | |
271 | - if( empty( $attribute ) ) { |
|
272 | - throw new \Exception( 'Attribute not found' ); |
|
271 | + if (empty($attribute)) { |
|
272 | + throw new \Exception('Attribute not found'); |
|
273 | 273 | } |
274 | 274 | |
275 | - $hiddenAttrIds = array_keys( $attribute ); |
|
276 | - $configAttrIds = array_keys( $attribute ); |
|
275 | + $hiddenAttrIds = array_keys($attribute); |
|
276 | + $configAttrIds = array_keys($attribute); |
|
277 | 277 | |
278 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
279 | - $this->object->addProduct( $this->testItem->getId(), 1, array(), array(), $configAttrIds, $hiddenAttrIds ); |
|
278 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
279 | + $this->object->addProduct($this->testItem->getId(), 1, array(), array(), $configAttrIds, $hiddenAttrIds); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
283 | 283 | public function testAddProductNegativeQuantityException() |
284 | 284 | { |
285 | - $this->setExpectedException( '\\Aimeos\\MShop\\Order\\Exception' ); |
|
286 | - $this->object->addProduct( $this->testItem->getId(), -1 ); |
|
285 | + $this->setExpectedException('\\Aimeos\\MShop\\Order\\Exception'); |
|
286 | + $this->object->addProduct($this->testItem->getId(), -1); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
290 | 290 | public function testAddProductNoPriceException() |
291 | 291 | { |
292 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'MNOP' ); |
|
292 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('MNOP'); |
|
293 | 293 | |
294 | - $this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' ); |
|
295 | - $this->object->addProduct( $item->getId(), 1 ); |
|
294 | + $this->setExpectedException('\\Aimeos\\MShop\\Price\\Exception'); |
|
295 | + $this->object->addProduct($item->getId(), 1); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
299 | 299 | public function testAddProductConfigAttributeException() |
300 | 300 | { |
301 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
302 | - $this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array( -1 ) ); |
|
301 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
302 | + $this->object->addProduct($this->testItem->getId(), 1, array(), array(), array( -1 )); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
306 | 306 | public function testAddProductEmptySelectionException() |
307 | 307 | { |
308 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:noSel' ); |
|
308 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:noSel'); |
|
309 | 309 | |
310 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
311 | - $this->object->addProduct( $item->getId(), 1 ); |
|
310 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
311 | + $this->object->addProduct($item->getId(), 1); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
315 | 315 | public function testAddProductSelectionWithPricelessItem() |
316 | 316 | { |
317 | - $this->object->addProduct( $this->testItem->getId(), 1 ); |
|
317 | + $this->object->addProduct($this->testItem->getId(), 1); |
|
318 | 318 | |
319 | - $this->assertEquals( 'U:TESTPSUB01', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
319 | + $this->assertEquals('U:TESTPSUB01', $this->object->get()->getProduct(0)->getProductCode()); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | |
323 | 323 | public function testAddProductLowQuantityPriceException() |
324 | 324 | { |
325 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'IJKL' ); |
|
325 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('IJKL'); |
|
326 | 326 | |
327 | - $this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' ); |
|
328 | - $this->object->addProduct( $item->getId(), 1 ); |
|
327 | + $this->setExpectedException('\\Aimeos\\MShop\\Price\\Exception'); |
|
328 | + $this->object->addProduct($item->getId(), 1); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
332 | 332 | public function testAddProductHigherQuantities() |
333 | 333 | { |
334 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'IJKL' ); |
|
334 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('IJKL'); |
|
335 | 335 | |
336 | - $this->object->addProduct( $item->getId(), 2, array(), array(), array(), array(), array(), 'unit_warehouse3' ); |
|
336 | + $this->object->addProduct($item->getId(), 2, array(), array(), array(), array(), array(), 'unit_warehouse3'); |
|
337 | 337 | |
338 | - $this->assertEquals( 2, $this->object->get()->getProduct( 0 )->getQuantity() ); |
|
339 | - $this->assertEquals( 'IJKL', $this->object->get()->getProduct( 0 )->getProductCode() ); |
|
338 | + $this->assertEquals(2, $this->object->get()->getProduct(0)->getQuantity()); |
|
339 | + $this->assertEquals('IJKL', $this->object->get()->getProduct(0)->getProductCode()); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | |
343 | 343 | public function testDeleteProductFlagError() |
344 | 344 | { |
345 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
345 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
346 | 346 | |
347 | - $item = $this->object->get()->getProduct( 0 ); |
|
348 | - $item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ); |
|
347 | + $item = $this->object->get()->getProduct(0); |
|
348 | + $item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE); |
|
349 | 349 | |
350 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
351 | - $this->object->deleteProduct( 0 ); |
|
350 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
351 | + $this->object->deleteProduct(0); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | |
355 | 355 | public function testEditProduct() |
356 | 356 | { |
357 | - $this->object->addProduct( $this->testItem->getId(), 1 ); |
|
357 | + $this->object->addProduct($this->testItem->getId(), 1); |
|
358 | 358 | |
359 | - $item = $this->object->get()->getProduct( 0 ); |
|
360 | - $this->assertEquals( 1, $item->getQuantity() ); |
|
359 | + $item = $this->object->get()->getProduct(0); |
|
360 | + $this->assertEquals(1, $item->getQuantity()); |
|
361 | 361 | |
362 | - $this->object->editProduct( 0, 4 ); |
|
362 | + $this->object->editProduct(0, 4); |
|
363 | 363 | |
364 | - $item = $this->object->get()->getProduct( 0 ); |
|
365 | - $this->assertEquals( 4, $item->getQuantity() ); |
|
366 | - $this->assertEquals( 'U:TESTPSUB01', $item->getProductCode() ); |
|
364 | + $item = $this->object->get()->getProduct(0); |
|
365 | + $this->assertEquals(4, $item->getQuantity()); |
|
366 | + $this->assertEquals('U:TESTPSUB01', $item->getProductCode()); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | |
370 | 370 | public function testEditProductAttributes() |
371 | 371 | { |
372 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
372 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
373 | 373 | |
374 | 374 | $search = $attributeManager->createSearch(); |
375 | 375 | $conditions = array( |
376 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
377 | - $search->combine( '||', array( |
|
378 | - $search->combine( '&&', array( |
|
379 | - $search->compare( '==', 'attribute.code', 'xs' ), |
|
380 | - $search->compare( '==', 'attribute.type.code', 'size' ), |
|
381 | - ) ), |
|
382 | - $search->combine( '&&', array( |
|
383 | - $search->compare( '==', 'attribute.code', 'white' ), |
|
384 | - $search->compare( '==', 'attribute.type.code', 'color' ), |
|
385 | - ) ), |
|
386 | - ) ) |
|
376 | + $search->compare('==', 'attribute.domain', 'product'), |
|
377 | + $search->combine('||', array( |
|
378 | + $search->combine('&&', array( |
|
379 | + $search->compare('==', 'attribute.code', 'xs'), |
|
380 | + $search->compare('==', 'attribute.type.code', 'size'), |
|
381 | + )), |
|
382 | + $search->combine('&&', array( |
|
383 | + $search->compare('==', 'attribute.code', 'white'), |
|
384 | + $search->compare('==', 'attribute.type.code', 'color'), |
|
385 | + )), |
|
386 | + )) |
|
387 | 387 | ); |
388 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
389 | - $attributes = $attributeManager->searchItems( $search ); |
|
388 | + $search->setConditions($search->combine('&&', $conditions)); |
|
389 | + $attributes = $attributeManager->searchItems($search); |
|
390 | 390 | |
391 | - if( ( $attribute = reset( $attributes ) ) === false ) { |
|
392 | - throw new \Exception( 'No attributes available' ); |
|
391 | + if (($attribute = reset($attributes)) === false) { |
|
392 | + throw new \Exception('No attributes available'); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
396 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' ); |
|
396 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP'); |
|
397 | 397 | |
398 | - $this->object->addProduct( $item->getId(), 1, array(), array(), array_keys( $attributes ) ); |
|
399 | - $this->object->editProduct( 0, 4 ); |
|
398 | + $this->object->addProduct($item->getId(), 1, array(), array(), array_keys($attributes)); |
|
399 | + $this->object->editProduct(0, 4); |
|
400 | 400 | |
401 | - $item = $this->object->get()->getProduct( 0 ); |
|
402 | - $this->assertEquals( 2, count( $item->getAttributes() ) ); |
|
403 | - $this->assertEquals( 4, $item->getQuantity() ); |
|
401 | + $item = $this->object->get()->getProduct(0); |
|
402 | + $this->assertEquals(2, count($item->getAttributes())); |
|
403 | + $this->assertEquals(4, $item->getQuantity()); |
|
404 | 404 | |
405 | 405 | |
406 | - $this->object->editProduct( 0, 3, array(), array( $attribute->getType() ) ); |
|
406 | + $this->object->editProduct(0, 3, array(), array($attribute->getType())); |
|
407 | 407 | |
408 | - $item = $this->object->get()->getProduct( 0 ); |
|
409 | - $this->assertEquals( 3, $item->getQuantity() ); |
|
410 | - $this->assertEquals( 1, count( $item->getAttributes() ) ); |
|
411 | - $this->assertEquals( 'U:TESTPSUB01', $item->getProductCode() ); |
|
408 | + $item = $this->object->get()->getProduct(0); |
|
409 | + $this->assertEquals(3, $item->getQuantity()); |
|
410 | + $this->assertEquals(1, count($item->getAttributes())); |
|
411 | + $this->assertEquals('U:TESTPSUB01', $item->getProductCode()); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | |
415 | 415 | public function testEditProductFlagError() |
416 | 416 | { |
417 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
417 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
418 | 418 | |
419 | - $item = $this->object->get()->getProduct( 0 ); |
|
420 | - $item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ); |
|
419 | + $item = $this->object->get()->getProduct(0); |
|
420 | + $item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE); |
|
421 | 421 | |
422 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
423 | - $this->object->editProduct( 0, 4 ); |
|
422 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
423 | + $this->object->editProduct(0, 4); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | |
427 | 427 | public function testAddCoupon() |
428 | 428 | { |
429 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
430 | - $this->object->addCoupon( 'GHIJ' ); |
|
429 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
430 | + $this->object->addCoupon('GHIJ'); |
|
431 | 431 | |
432 | 432 | $basket = $this->object->get(); |
433 | 433 | |
434 | - $this->assertEquals( 1, count( $basket->getCoupons() ) ); |
|
434 | + $this->assertEquals(1, count($basket->getCoupons())); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | |
438 | 438 | public function testAddCouponInvalidCode() |
439 | 439 | { |
440 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
441 | - $this->object->addCoupon( 'invalid' ); |
|
440 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
441 | + $this->object->addCoupon('invalid'); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | |
445 | 445 | public function testAddCouponMissingRequirements() |
446 | 446 | { |
447 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
448 | - $this->object->addCoupon( 'OPQR' ); |
|
447 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
448 | + $this->object->addCoupon('OPQR'); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
452 | 452 | public function testDeleteCoupon() |
453 | 453 | { |
454 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
455 | - $this->object->addCoupon( '90AB' ); |
|
456 | - $this->object->deleteCoupon( '90AB' ); |
|
454 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
455 | + $this->object->addCoupon('90AB'); |
|
456 | + $this->object->deleteCoupon('90AB'); |
|
457 | 457 | |
458 | 458 | $basket = $this->object->get(); |
459 | 459 | |
460 | - $this->assertEquals( 0, count( $basket->getCoupons() ) ); |
|
460 | + $this->assertEquals(0, count($basket->getCoupons())); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
464 | 464 | public function testClear() |
465 | 465 | { |
466 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
466 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
467 | 467 | $this->object->clear(); |
468 | 468 | |
469 | - $this->assertEquals( 0, count( $this->object->get()->getProducts() ) ); |
|
469 | + $this->assertEquals(0, count($this->object->get()->getProducts())); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | |
473 | 473 | public function testSetAddressDelete() |
474 | 474 | { |
475 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null ); |
|
475 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null); |
|
476 | 476 | |
477 | - $this->setExpectedException( '\Aimeos\MShop\Order\Exception' ); |
|
478 | - $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
477 | + $this->setExpectedException('\Aimeos\MShop\Order\Exception'); |
|
478 | + $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
482 | 482 | public function testSetBillingAddressByItem() |
483 | 483 | { |
484 | - $item = $this->getAddress( 'Example company' ); |
|
484 | + $item = $this->getAddress('Example company'); |
|
485 | 485 | |
486 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item ); |
|
486 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item); |
|
487 | 487 | |
488 | - $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
489 | - $this->assertEquals( 'Example company', $address->getCompany() ); |
|
488 | + $address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
489 | + $this->assertEquals('Example company', $address->getCompany()); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | |
@@ -514,37 +514,37 @@ discard block |
||
514 | 514 | 'order.base.address.flag' => 0, |
515 | 515 | ); |
516 | 516 | |
517 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture ); |
|
517 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture); |
|
518 | 518 | |
519 | - $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
520 | - $this->assertEquals( 'Example company', $address->getCompany() ); |
|
521 | - $this->assertEquals( 'Dr.', $address->getTitle() ); |
|
522 | - $this->assertEquals( 'firstunit', $address->getFirstname() ); |
|
519 | + $address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
520 | + $this->assertEquals('Example company', $address->getCompany()); |
|
521 | + $this->assertEquals('Dr.', $address->getTitle()); |
|
522 | + $this->assertEquals('firstunit', $address->getFirstname()); |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | |
526 | 526 | public function testSetBillingAddressByArrayError() |
527 | 527 | { |
528 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
529 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array( 'error' => false ) ); |
|
528 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
529 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array('error' => false)); |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | |
533 | 533 | public function testSetBillingAddressParameterError() |
534 | 534 | { |
535 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
536 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error' ); |
|
535 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
536 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error'); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
540 | 540 | public function testSetDeliveryAddressByItem() |
541 | 541 | { |
542 | - $item = $this->getAddress( 'Example company' ); |
|
542 | + $item = $this->getAddress('Example company'); |
|
543 | 543 | |
544 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item ); |
|
544 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item); |
|
545 | 545 | |
546 | - $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY ); |
|
547 | - $this->assertEquals( 'Example company', $address->getCompany() ); |
|
546 | + $address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY); |
|
547 | + $this->assertEquals('Example company', $address->getCompany()); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | |
@@ -571,119 +571,119 @@ discard block |
||
571 | 571 | 'order.base.address.website' => 'www.example.com', |
572 | 572 | 'order.base.address.flag' => 0, |
573 | 573 | ); |
574 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture ); |
|
574 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture); |
|
575 | 575 | |
576 | - $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY ); |
|
577 | - $this->assertEquals( 'Example company', $address->getCompany() ); |
|
578 | - $this->assertEquals( 'Dr.', $address->getTitle() ); |
|
579 | - $this->assertEquals( 'firstunit', $address->getFirstname() ); |
|
576 | + $address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY); |
|
577 | + $this->assertEquals('Example company', $address->getCompany()); |
|
578 | + $this->assertEquals('Dr.', $address->getTitle()); |
|
579 | + $this->assertEquals('firstunit', $address->getFirstname()); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
583 | 583 | public function testSetDeliveryAddressByArrayError() |
584 | 584 | { |
585 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
586 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array( 'error' => false ) ); |
|
585 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
586 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array('error' => false)); |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | |
590 | 590 | public function testSetDeliveryAddressTypeError() |
591 | 591 | { |
592 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
593 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error' ); |
|
592 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
593 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error'); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | |
597 | 597 | public function testSetServicePayment() |
598 | 598 | { |
599 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' ); |
|
600 | - $service = $manager->findItem( 'unitpaymentcode', array(), 'service', 'payment' ); |
|
599 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'service'); |
|
600 | + $service = $manager->findItem('unitpaymentcode', array(), 'service', 'payment'); |
|
601 | 601 | |
602 | - $this->object->setService( 'payment', $service->getId(), array() ); |
|
603 | - $this->assertEquals( 'unitpaymentcode', $this->object->get()->getService( 'payment' )->getCode() ); |
|
602 | + $this->object->setService('payment', $service->getId(), array()); |
|
603 | + $this->assertEquals('unitpaymentcode', $this->object->get()->getService('payment')->getCode()); |
|
604 | 604 | |
605 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
606 | - $this->object->setService( 'payment', $service->getId(), array( 'prepay' => true ) ); |
|
605 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
606 | + $this->object->setService('payment', $service->getId(), array('prepay' => true)); |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | |
610 | 610 | public function testSetDeliveryOption() |
611 | 611 | { |
612 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' ); |
|
613 | - $service = $manager->findItem( 'unitcode', array(), 'service', 'delivery' ); |
|
612 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'service'); |
|
613 | + $service = $manager->findItem('unitcode', array(), 'service', 'delivery'); |
|
614 | 614 | |
615 | - $this->object->setService( 'delivery', $service->getId(), array() ); |
|
616 | - $this->assertEquals( 'unitcode', $this->object->get()->getService( 'delivery' )->getCode() ); |
|
615 | + $this->object->setService('delivery', $service->getId(), array()); |
|
616 | + $this->assertEquals('unitcode', $this->object->get()->getService('delivery')->getCode()); |
|
617 | 617 | |
618 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
619 | - $this->object->setService( 'delivery', $service->getId(), array( 'fast shipping' => true, 'air shipping' => false ) ); |
|
618 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception'); |
|
619 | + $this->object->setService('delivery', $service->getId(), array('fast shipping' => true, 'air shipping' => false)); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | |
623 | 623 | public function testCheckLocale() |
624 | 624 | { |
625 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' ); |
|
626 | - $payment = $manager->findItem( 'unitpaymentcode', array(), 'service', 'payment' ); |
|
627 | - $delivery = $manager->findItem( 'unitcode', array(), 'service', 'delivery' ); |
|
625 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'service'); |
|
626 | + $payment = $manager->findItem('unitpaymentcode', array(), 'service', 'payment'); |
|
627 | + $delivery = $manager->findItem('unitcode', array(), 'service', 'delivery'); |
|
628 | 628 | |
629 | - $this->object->addProduct( $this->testItem->getId(), 2 ); |
|
630 | - $this->object->addCoupon( 'OPQR' ); |
|
629 | + $this->object->addProduct($this->testItem->getId(), 2); |
|
630 | + $this->object->addCoupon('OPQR'); |
|
631 | 631 | |
632 | - $this->object->setService( 'payment', $payment->getId() ); |
|
633 | - $this->object->setService( 'delivery', $delivery->getId() ); |
|
632 | + $this->object->setService('payment', $payment->getId()); |
|
633 | + $this->object->setService('delivery', $delivery->getId()); |
|
634 | 634 | |
635 | 635 | $basket = $this->object->get(); |
636 | 636 | $price = $basket->getPrice(); |
637 | 637 | |
638 | - foreach( $basket->getProducts() as $product ) |
|
638 | + foreach ($basket->getProducts() as $product) |
|
639 | 639 | { |
640 | - $this->assertEquals( 2, $product->getQuantity() ); |
|
641 | - $product->getPrice()->setCurrencyId( 'CHF' ); |
|
640 | + $this->assertEquals(2, $product->getQuantity()); |
|
641 | + $product->getPrice()->setCurrencyId('CHF'); |
|
642 | 642 | } |
643 | 643 | |
644 | - $basket->getService( 'delivery' )->getPrice()->setCurrencyId( 'CHF' ); |
|
645 | - $basket->getService( 'payment' )->getPrice()->setCurrencyId( 'CHF' ); |
|
646 | - $basket->getLocale()->setCurrencyId( 'CHF' ); |
|
647 | - $price->setCurrencyId( 'CHF' ); |
|
644 | + $basket->getService('delivery')->getPrice()->setCurrencyId('CHF'); |
|
645 | + $basket->getService('payment')->getPrice()->setCurrencyId('CHF'); |
|
646 | + $basket->getLocale()->setCurrencyId('CHF'); |
|
647 | + $price->setCurrencyId('CHF'); |
|
648 | 648 | |
649 | - $this->context->getLocale()->setCurrencyId( 'CHF' ); |
|
650 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress( 'Example company' ) ); |
|
649 | + $this->context->getLocale()->setCurrencyId('CHF'); |
|
650 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress('Example company')); |
|
651 | 651 | |
652 | - $this->context->getSession()->set( 'aimeos/basket/currency', 'CHF' ); |
|
653 | - $this->context->getLocale()->setCurrencyId( 'EUR' ); |
|
652 | + $this->context->getSession()->set('aimeos/basket/currency', 'CHF'); |
|
653 | + $this->context->getLocale()->setCurrencyId('EUR'); |
|
654 | 654 | |
655 | - $this->context->getSession()->set( 'aimeos/basket/content-unittest-en-EUR-', null ); |
|
655 | + $this->context->getSession()->set('aimeos/basket/content-unittest-en-EUR-', null); |
|
656 | 656 | |
657 | - $object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
|
657 | + $object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context); |
|
658 | 658 | $basket = $object->get(); |
659 | 659 | |
660 | - foreach( $basket->getProducts() as $product ) |
|
660 | + foreach ($basket->getProducts() as $product) |
|
661 | 661 | { |
662 | - $this->assertEquals( 'EUR', $product->getPrice()->getCurrencyId() ); |
|
663 | - $this->assertEquals( 2, $product->getQuantity() ); |
|
662 | + $this->assertEquals('EUR', $product->getPrice()->getCurrencyId()); |
|
663 | + $this->assertEquals(2, $product->getQuantity()); |
|
664 | 664 | } |
665 | 665 | |
666 | - $this->assertEquals( 'EUR', $basket->getService( 'payment' )->getPrice()->getCurrencyId() ); |
|
667 | - $this->assertEquals( 'EUR', $basket->getService( 'delivery' )->getPrice()->getCurrencyId() ); |
|
668 | - $this->assertEquals( 'EUR', $basket->getLocale()->getCurrencyId() ); |
|
669 | - $this->assertEquals( 'EUR', $basket->getPrice()->getCurrencyId() ); |
|
666 | + $this->assertEquals('EUR', $basket->getService('payment')->getPrice()->getCurrencyId()); |
|
667 | + $this->assertEquals('EUR', $basket->getService('delivery')->getPrice()->getCurrencyId()); |
|
668 | + $this->assertEquals('EUR', $basket->getLocale()->getCurrencyId()); |
|
669 | + $this->assertEquals('EUR', $basket->getPrice()->getCurrencyId()); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | |
673 | 673 | /** |
674 | 674 | * @param string $company |
675 | 675 | */ |
676 | - protected function getAddress( $company ) |
|
676 | + protected function getAddress($company) |
|
677 | 677 | { |
678 | - $customer = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelperFrontend::getContext(), 'Standard' ); |
|
679 | - $addressManager = $customer->getSubManager( 'address', 'Standard' ); |
|
678 | + $customer = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelperFrontend::getContext(), 'Standard'); |
|
679 | + $addressManager = $customer->getSubManager('address', 'Standard'); |
|
680 | 680 | |
681 | 681 | $search = $addressManager->createSearch(); |
682 | - $search->setConditions( $search->compare( '==', 'customer.address.company', $company ) ); |
|
683 | - $items = $addressManager->searchItems( $search ); |
|
682 | + $search->setConditions($search->compare('==', 'customer.address.company', $company)); |
|
683 | + $items = $addressManager->searchItems($search); |
|
684 | 684 | |
685 | - if( ( $item = reset( $items ) ) === false ) { |
|
686 | - throw new \Exception( sprintf( 'No address item with company "%1$s" found', $company ) ); |
|
685 | + if (($item = reset($items)) === false) { |
|
686 | + throw new \Exception(sprintf('No address item with company "%1$s" found', $company)); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | return $item; |
@@ -4,7 +4,7 @@ |
||
4 | 4 | 'frontend' => array( |
5 | 5 | 'basket' => array( |
6 | 6 | 'decorators' => array( |
7 | - 'local' => array( 'Category' ), |
|
7 | + 'local' => array('Category'), |
|
8 | 8 | ), |
9 | 9 | ), |
10 | 10 | ), |
@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | public static function bootstrap() |
16 | 16 | { |
17 | 17 | self::getAimeos(); |
18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
19 | - \Aimeos\Controller\Frontend\Factory::setCache( false ); |
|
18 | + \Aimeos\MShop\Factory::setCache(false); |
|
19 | + \Aimeos\Controller\Frontend\Factory::setCache(false); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | - public static function getContext( $site = 'unittest' ) |
|
23 | + public static function getContext($site = 'unittest') |
|
24 | 24 | { |
25 | - if( !isset( self::$context[$site] ) ) { |
|
26 | - self::$context[$site] = self::createContext( $site ); |
|
25 | + if (!isset(self::$context[$site])) { |
|
26 | + self::$context[$site] = self::createContext($site); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return clone self::$context[$site]; |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | |
33 | 33 | private static function getAimeos() |
34 | 34 | { |
35 | - if( !isset( self::$aimeos ) ) |
|
35 | + if (!isset(self::$aimeos)) |
|
36 | 36 | { |
37 | 37 | require_once 'Bootstrap.php'; |
38 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
38 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
39 | 39 | |
40 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
41 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
40 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
41 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return self::$aimeos; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @param string $site |
50 | 50 | */ |
51 | - private static function createContext( $site ) |
|
51 | + private static function createContext($site) |
|
52 | 52 | { |
53 | 53 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
54 | 54 | $aimeos = self::getAimeos(); |
@@ -58,34 +58,34 @@ discard block |
||
58 | 58 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
59 | 59 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
60 | 60 | |
61 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
62 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
63 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
64 | - $ctx->setConfig( $conf ); |
|
61 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
62 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
63 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
64 | + $ctx->setConfig($conf); |
|
65 | 65 | |
66 | 66 | |
67 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
68 | - $ctx->setDatabaseManager( $dbm ); |
|
67 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
68 | + $ctx->setDatabaseManager($dbm); |
|
69 | 69 | |
70 | 70 | |
71 | - $logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
72 | - $ctx->setLogger( $logger ); |
|
71 | + $logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
72 | + $ctx->setLogger($logger); |
|
73 | 73 | |
74 | 74 | |
75 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
76 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
75 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
76 | + $ctx->setI18n(array('de' => $i18n)); |
|
77 | 77 | |
78 | 78 | |
79 | 79 | $session = new \Aimeos\MW\Session\None(); |
80 | - $ctx->setSession( $session ); |
|
80 | + $ctx->setSession($session); |
|
81 | 81 | |
82 | 82 | |
83 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
84 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
85 | - $ctx->setLocale( $locale ); |
|
83 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
84 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
85 | + $ctx->setLocale($locale); |
|
86 | 86 | |
87 | 87 | |
88 | - $ctx->setEditor( 'core:controller/frontend' ); |
|
88 | + $ctx->setEditor('core:controller/frontend'); |
|
89 | 89 | |
90 | 90 | return $ctx; |
91 | 91 | } |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | * @param string $name Name of the manager |
26 | 26 | * @return \Aimeos\MShop\Common\Manager\Iface Manager object |
27 | 27 | */ |
28 | - public function createManager( $name ) |
|
28 | + public function createManager($name) |
|
29 | 29 | { |
30 | - return $this->getController()->createManager( $name ); |
|
30 | + return $this->getController()->createManager($name); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys |
53 | 53 | * @since 2015.08 |
54 | 54 | */ |
55 | - public function getCatalogPath( $id, array $domains = array( 'text', 'media' ) ) |
|
55 | + public function getCatalogPath($id, array $domains = array('text', 'media')) |
|
56 | 56 | { |
57 | - return $this->getController()->getCatalogPath( $id, $domains ); |
|
57 | + return $this->getController()->getCatalogPath($id, $domains); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant |
70 | 70 | * @since 2015.08 |
71 | 71 | */ |
72 | - public function getCatalogTree( $id = null, array $domains = array( 'text', 'media' ), |
|
73 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null ) |
|
72 | + public function getCatalogTree($id = null, array $domains = array('text', 'media'), |
|
73 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null) |
|
74 | 74 | { |
75 | - return $this->getController()->getCatalogTree( $id, $domains, $level, $search ); |
|
75 | + return $this->getController()->getCatalogTree($id, $domains, $level, $search); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | * @return array Associative list of key values as key and the product count for this key as value |
85 | 85 | * @since 2015.08 |
86 | 86 | */ |
87 | - public function aggregateIndex( \Aimeos\MW\Criteria\Iface $filter, $key ) |
|
87 | + public function aggregateIndex(\Aimeos\MW\Criteria\Iface $filter, $key) |
|
88 | 88 | { |
89 | - return $this->getController()->aggregateIndex( $filter, $key ); |
|
89 | + return $this->getController()->aggregateIndex($filter, $key); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
99 | 99 | * @since 2015.08 |
100 | 100 | */ |
101 | - public function addIndexFilterCategory( \Aimeos\MW\Criteria\Iface $search, $catid ) |
|
101 | + public function addIndexFilterCategory(\Aimeos\MW\Criteria\Iface $search, $catid) |
|
102 | 102 | { |
103 | - return $this->getController()->addIndexFilterCategory( $search, $catid ); |
|
103 | + return $this->getController()->addIndexFilterCategory($search, $catid); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
114 | 114 | * @since 2015.08 |
115 | 115 | */ |
116 | - public function addIndexFilterText( \Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default' ) |
|
116 | + public function addIndexFilterText(\Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default') |
|
117 | 117 | { |
118 | - return $this->getController()->addIndexFilterText( $search, $input, $listtype ); |
|
118 | + return $this->getController()->addIndexFilterText($search, $input, $listtype); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
131 | 131 | * @since 2015.08 |
132 | 132 | */ |
133 | - public function createIndexFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
|
133 | + public function createIndexFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default') |
|
134 | 134 | { |
135 | - return $this->getController()->createIndexFilter( $sort, $direction, $start, $size, $listtype ); |
|
135 | + return $this->getController()->createIndexFilter($sort, $direction, $start, $size, $listtype); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
149 | 149 | * @since 2015.08 |
150 | 150 | */ |
151 | - public function createIndexFilterCategory( $catid, $sort = 'position', $direction = 'asc', $start = 0, $size = 100, $listtype = 'default' ) |
|
151 | + public function createIndexFilterCategory($catid, $sort = 'position', $direction = 'asc', $start = 0, $size = 100, $listtype = 'default') |
|
152 | 152 | { |
153 | - return $this->getController()->createIndexFilter( $catid, $sort, $direction, $start, $size, $listtype ); |
|
153 | + return $this->getController()->createIndexFilter($catid, $sort, $direction, $start, $size, $listtype); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
167 | 167 | * @since 2015.08 |
168 | 168 | */ |
169 | - public function createIndexFilterText( $input, $sort = 'relevance', $direction = 'asc', $start = 0, $size = 100, $listtype = 'default' ) |
|
169 | + public function createIndexFilterText($input, $sort = 'relevance', $direction = 'asc', $start = 0, $size = 100, $listtype = 'default') |
|
170 | 170 | { |
171 | - return $this->getController()->createIndexFilter( $input, $sort, $direction, $start, $size, $listtype ); |
|
171 | + return $this->getController()->createIndexFilter($input, $sort, $direction, $start, $size, $listtype); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
182 | 182 | * @since 2015.08 |
183 | 183 | */ |
184 | - public function getIndexItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
184 | + public function getIndexItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
185 | 185 | { |
186 | - return $this->getController()->getIndexItems( $filter, $domains, $total ); |
|
186 | + return $this->getController()->getIndexItems($filter, $domains, $total); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | * @return array List of product items implementing \Aimeos\MShop\Product\Item\Iface |
196 | 196 | * @since 2015.08 |
197 | 197 | */ |
198 | - public function getProductItems( array $ids, array $domains = array( 'media', 'price', 'text' ) ) |
|
198 | + public function getProductItems(array $ids, array $domains = array('media', 'price', 'text')) |
|
199 | 199 | { |
200 | - return $this->getController()->getProductItems( $ids, $domains ); |
|
200 | + return $this->getController()->getProductItems($ids, $domains); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | * @param string $type Type of the text like "name", "short", "long", etc. |
214 | 214 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
215 | 215 | */ |
216 | - public function createTextFilter( $input, $sort = null, $direction = 'desc', $start = 0, $size = 25, $listtype = 'default', $type = 'name' ) |
|
216 | + public function createTextFilter($input, $sort = null, $direction = 'desc', $start = 0, $size = 25, $listtype = 'default', $type = 'name') |
|
217 | 217 | { |
218 | - return $this->getController()->createTextFilter( $input, $sort, $direction, $start, $size, $listtype, $type ); |
|
218 | + return $this->getController()->createTextFilter($input, $sort, $direction, $start, $size, $listtype, $type); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions |
226 | 226 | * @return array Associative list of the product ID as key and the product text as value |
227 | 227 | */ |
228 | - public function getTextList( \Aimeos\MW\Criteria\Iface $filter ) |
|
228 | + public function getTextList(\Aimeos\MW\Criteria\Iface $filter) |
|
229 | 229 | { |
230 | - return $this->getController()->getTextList( $filter ); |
|
230 | + return $this->getController()->getTextList($filter); |
|
231 | 231 | } |
232 | 232 | } |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
28 | 28 | * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items |
29 | 29 | */ |
30 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
31 | - $ref = array( 'media', 'price', 'text' ) ) |
|
30 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
31 | + $ref = array('media', 'price', 'text')) |
|
32 | 32 | { |
33 | - return $this->getController()->getServices( $type, $basket, $ref ); |
|
33 | + return $this->getController()->getServices($type, $basket, $ref); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
44 | 44 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
45 | 45 | */ |
46 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
46 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
47 | 47 | { |
48 | - return $this->getController()->getServiceAttributes( $type, $serviceId, $basket ); |
|
48 | + return $this->getController()->getServiceAttributes($type, $serviceId, $basket); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @throws \Aimeos\MShop\Exception If service provider isn't available |
61 | 61 | * @throws \Exception If an error occurs |
62 | 62 | */ |
63 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
63 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
64 | 64 | { |
65 | - return $this->getController()->getServicePrice( $type, $serviceId, $basket ); |
|
65 | + return $this->getController()->getServicePrice($type, $serviceId, $basket); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @return array List of key/value pairs of attributes keys and an error message for values that are invalid or |
77 | 77 | * missing |
78 | 78 | */ |
79 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
79 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
80 | 80 | { |
81 | - return $this->getController()->checkServiceAttributes( $type, $serviceId, $attributes ); |
|
81 | + return $this->getController()->checkServiceAttributes($type, $serviceId, $attributes); |
|
82 | 82 | } |
83 | 83 | } |