Completed
Push — master ( 1d5010...eee81b )
by Aimeos
15:07
created
controller/frontend/tests/Controller/Frontend/Product/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 	{
16 16
 		$target = '\\Aimeos\\Controller\\Frontend\\Product\\Iface';
17 17
 
18
-		$controller = \Aimeos\Controller\Frontend\Product\Factory::createController( \TestHelperFrontend::getContext() );
19
-		$this->assertInstanceOf( $target, $controller );
18
+		$controller = \Aimeos\Controller\Frontend\Product\Factory::createController(\TestHelperFrontend::getContext());
19
+		$this->assertInstanceOf($target, $controller);
20 20
 
21
-		$controller = \Aimeos\Controller\Frontend\Product\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
22
-		$this->assertInstanceOf( $target, $controller );
21
+		$controller = \Aimeos\Controller\Frontend\Product\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
22
+		$this->assertInstanceOf($target, $controller);
23 23
 	}
24 24
 
25 25
 
26 26
 	public function testCreateControllerInvalidImplementation()
27 27
 	{
28
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
29
-		\Aimeos\Controller\Frontend\Product\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
28
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
29
+		\Aimeos\Controller\Frontend\Product\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testCreateControllerInvalidName()
34 34
 	{
35
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
36
-		\Aimeos\Controller\Frontend\Product\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
35
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
36
+		\Aimeos\Controller\Frontend\Product\Factory::createController(\TestHelperFrontend::getContext(), '%^');
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testCreateControllerNotExisting()
41 41
 	{
42
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
43
-		\Aimeos\Controller\Frontend\Product\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
42
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
43
+		\Aimeos\Controller\Frontend\Product\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
44 44
 	}
45 45
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Locale/Decorator/BaseTest.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,97 +20,97 @@
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Decorator\Base')
28
+			->setConstructorArgs([$this->stub, $this->context])
29 29
 			->getMockForAbstractClass();
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		unset( $this->context, $this->object, $this->stub );
35
+		unset($this->context, $this->object, $this->stub);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testConstructException()
40 40
 	{
41
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock();
41
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock();
42 42
 
43
-		$this->expectException( '\Aimeos\Controller\Frontend\Exception' );
43
+		$this->expectException('\Aimeos\Controller\Frontend\Exception');
44 44
 
45
-		$this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Decorator\Base')
46
+			->setConstructorArgs([$stub, $this->context])
47 47
 			->getMockForAbstractClass();
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testCall()
52 52
 	{
53
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Decorator\Base')
59
+			->setConstructorArgs([$stub, $this->context])
60 60
 			->getMockForAbstractClass();
61 61
 
62
-		$stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) );
62
+		$stub->expects($this->once())->method('invalid')->will($this->returnValue(true));
63 63
 
64
-		$this->assertTrue( $object->invalid() );
64
+		$this->assertTrue($object->invalid());
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testCreateFilter()
69 69
 	{
70
-		$search = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' )->createSearch();
70
+		$search = \Aimeos\MShop\Factory::createManager($this->context, 'locale')->createSearch();
71 71
 
72
-		$this->stub->expects( $this->once() )->method( 'createFilter' )
73
-			->will( $this->returnValue( $search ) );
72
+		$this->stub->expects($this->once())->method('createFilter')
73
+			->will($this->returnValue($search));
74 74
 
75
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() );
75
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter());
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testGetItem()
80 80
 	{
81
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' )->createItem();
81
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'locale')->createItem();
82 82
 
83
-		$this->stub->expects( $this->once() )->method( 'getItem' )
84
-			->will( $this->returnValue( $item ) );
83
+		$this->stub->expects($this->once())->method('getItem')
84
+			->will($this->returnValue($item));
85 85
 
86
-		$this->assertInstanceOf( '\Aimeos\MShop\Locale\Item\Iface', $this->object->getItem( -1 ) );
86
+		$this->assertInstanceOf('\Aimeos\MShop\Locale\Item\Iface', $this->object->getItem( -1 ));
87 87
 	}
88 88
 
89 89
 
90 90
 	public function testSearchItems()
91 91
 	{
92
-		$filter = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' )->createSearch();
92
+		$filter = \Aimeos\MShop\Factory::createManager($this->context, 'locale')->createSearch();
93 93
 
94
-		$this->stub->expects( $this->once() )->method( 'searchItems' )
95
-			->will( $this->returnValue( [] ) );
94
+		$this->stub->expects($this->once())->method('searchItems')
95
+			->will($this->returnValue([]));
96 96
 
97
-		$this->assertEquals( [], $this->object->searchItems( $filter, ['media'] ) );
97
+		$this->assertEquals([], $this->object->searchItems($filter, ['media']));
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testGetController()
102 102
 	{
103
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
103
+		$result = $this->access('getController')->invokeArgs($this->object, []);
104 104
 
105
-		$this->assertSame( $this->stub, $result );
105
+		$this->assertSame($this->stub, $result);
106 106
 	}
107 107
 
108 108
 
109
-	protected function access( $name )
109
+	protected function access($name)
110 110
 	{
111
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' );
112
-		$method = $class->getMethod( $name );
113
-		$method->setAccessible( true );
111
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Locale\Decorator\Base');
112
+		$method = $class->getMethod($name);
113
+		$method->setAccessible(true);
114 114
 
115 115
 		return $method;
116 116
 	}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Locale/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 	{
16 16
 		$target = '\\Aimeos\\Controller\\Frontend\\Locale\\Iface';
17 17
 
18
-		$controller = \Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext() );
19
-		$this->assertInstanceOf( $target, $controller );
18
+		$controller = \Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext());
19
+		$this->assertInstanceOf($target, $controller);
20 20
 
21
-		$controller = \Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
22
-		$this->assertInstanceOf( $target, $controller );
21
+		$controller = \Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
22
+		$this->assertInstanceOf($target, $controller);
23 23
 	}
24 24
 
25 25
 
26 26
 	public function testCreateControllerInvalidImplementation()
27 27
 	{
28
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
29
-		\Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
28
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
29
+		\Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testCreateControllerInvalidName()
34 34
 	{
35
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
36
-		\Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
35
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
36
+		\Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), '%^');
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testCreateControllerNotExisting()
41 41
 	{
42
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
43
-		\Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
42
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
43
+		\Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
44 44
 	}
45 45
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/FactoryTest.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -14,92 +14,92 @@
 block discarded – undo
14 14
 {
15 15
 	public function testCreateController()
16 16
 	{
17
-		$controller = \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket' );
18
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Frontend\\Iface', $controller );
17
+		$controller = \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket');
18
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Frontend\\Iface', $controller);
19 19
 	}
20 20
 
21 21
 
22 22
 	public function testCreateControllerEmpty()
23 23
 	{
24
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
25
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), '' );
24
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
25
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), '');
26 26
 	}
27 27
 
28 28
 
29 29
 	public function testCreateControllerInvalidName()
30 30
 	{
31
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
32
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
31
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
32
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), '%^');
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testCreateControllerNotExisting()
37 37
 	{
38
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
39
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
38
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
39
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
40 40
 	}
41 41
 
42 42
 
43 43
 	public function testCreateSubControllerNotExisting()
44 44
 	{
45
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
46
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket/notexist' );
45
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
46
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket/notexist');
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testClear()
51 51
 	{
52
-		$cache = \Aimeos\Controller\Frontend\Factory::setCache( true );
52
+		$cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
53 53
 
54 54
 		$context = \TestHelperFrontend::getContext();
55 55
 
56
-		$controller1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
56
+		$controller1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
57 57
 		\Aimeos\Controller\Frontend\Factory::clear();
58
-		$controller2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
58
+		$controller2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
59 59
 
60
-		\Aimeos\Controller\Frontend\Factory::setCache( $cache );
60
+		\Aimeos\Controller\Frontend\Factory::setCache($cache);
61 61
 
62
-		$this->assertNotSame( $controller1, $controller2 );
62
+		$this->assertNotSame($controller1, $controller2);
63 63
 	}
64 64
 
65 65
 
66 66
 	public function testClearSite()
67 67
 	{
68
-		$cache = \Aimeos\Controller\Frontend\Factory::setCache( true );
68
+		$cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
69 69
 
70 70
 		$context = \TestHelperFrontend::getContext();
71 71
 
72
-		$basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
73
-		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
74
-		\Aimeos\Controller\Frontend\Factory::clear( (string) $context );
72
+		$basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
73
+		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
74
+		\Aimeos\Controller\Frontend\Factory::clear((string) $context);
75 75
 
76
-		$basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
77
-		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
76
+		$basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
77
+		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
78 78
 
79
-		\Aimeos\Controller\Frontend\Factory::setCache( $cache );
79
+		\Aimeos\Controller\Frontend\Factory::setCache($cache);
80 80
 
81
-		$this->assertNotSame( $basket1, $basket2 );
82
-		$this->assertNotSame( $catalog1, $catalog2 );
81
+		$this->assertNotSame($basket1, $basket2);
82
+		$this->assertNotSame($catalog1, $catalog2);
83 83
 	}
84 84
 
85 85
 
86 86
 	public function testClearSpecific()
87 87
 	{
88
-		$cache = \Aimeos\Controller\Frontend\Factory::setCache( true );
88
+		$cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
89 89
 
90 90
 		$context = \TestHelperFrontend::getContext();
91 91
 
92
-		$basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
93
-		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
94
-		\Aimeos\Controller\Frontend\Factory::clear( (string) $context, 'basket' );
92
+		$basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
93
+		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
94
+		\Aimeos\Controller\Frontend\Factory::clear((string) $context, 'basket');
95 95
 
96
-		$basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
97
-		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
96
+		$basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
97
+		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
98 98
 
99
-		\Aimeos\Controller\Frontend\Factory::setCache( $cache );
99
+		\Aimeos\Controller\Frontend\Factory::setCache($cache);
100 100
 
101
-		$this->assertNotSame( $basket1, $basket2 );
102
-		$this->assertSame( $catalog1, $catalog2 );
101
+		$this->assertNotSame($basket1, $basket2);
102
+		$this->assertSame($catalog1, $catalog2);
103 103
 	}
104 104
 
105 105
 }
106 106
\ No newline at end of file
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Basket/Decorator/CategoryTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -18,35 +18,35 @@
 block discarded – undo
18 18
 	protected function setUp()
19 19
 	{
20 20
 		$this->context = \TestHelperFrontend::getContext();
21
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
22
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category( $object, $this->context );
21
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
22
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category($object, $this->context);
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function tearDown()
27 27
 	{
28 28
 		$this->object->clear();
29
-		$this->context->getSession()->set( 'aimeos', [] );
29
+		$this->context->getSession()->set('aimeos', []);
30 30
 
31
-		unset( $this->object );
31
+		unset($this->object);
32 32
 	}
33 33
 
34 34
 
35 35
 	public function testAddProductWithCategory()
36 36
 	{
37
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
38
-		$item = $manager->findItem( 'CNE' );
37
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
38
+		$item = $manager->findItem('CNE');
39 39
 
40
-		$this->object->addProduct( $item->getId(), 5 );
40
+		$this->object->addProduct($item->getId(), 5);
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testAddProductNoCategory()
45 45
 	{
46
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
47
-		$item = $manager->findItem( 'ABCD' );
46
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
47
+		$item = $manager->findItem('ABCD');
48 48
 
49
-		$this->expectException( '\Aimeos\Controller\Frontend\Basket\Exception' );
50
-		$this->object->addProduct( $item->getId(), 5 );
49
+		$this->expectException('\Aimeos\Controller\Frontend\Basket\Exception');
50
+		$this->object->addProduct($item->getId(), 5);
51 51
 	}
52 52
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/Decorator/BaseTest.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -20,54 +20,54 @@  discard block
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Decorator\Base')
28
+			->setConstructorArgs([$this->stub, $this->context])
29 29
 			->getMockForAbstractClass();
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		unset( $this->context, $this->object, $this->stub );
35
+		unset($this->context, $this->object, $this->stub);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testConstructException()
40 40
 	{
41
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock();
41
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock();
42 42
 
43
-		$this->expectException( '\Aimeos\Controller\Frontend\Exception' );
43
+		$this->expectException('\Aimeos\Controller\Frontend\Exception');
44 44
 
45
-		$this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Decorator\Base')
46
+			->setConstructorArgs([$stub, $this->context])
47 47
 			->getMockForAbstractClass();
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testCall()
52 52
 	{
53
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Decorator\Base')
59
+			->setConstructorArgs([$stub, $this->context])
60 60
 			->getMockForAbstractClass();
61 61
 
62
-		$stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) );
62
+		$stub->expects($this->once())->method('invalid')->will($this->returnValue(true));
63 63
 
64
-		$this->assertTrue( $object->invalid() );
64
+		$this->assertTrue($object->invalid());
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testClear()
69 69
 	{
70
-		$this->stub->expects( $this->once() )->method( 'clear' );
70
+		$this->stub->expects($this->once())->method('clear');
71 71
 
72 72
 		$this->object->clear();
73 73
 	}
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
 	public function testGet()
77 77
 	{
78 78
 		$context = \TestHelperFrontend::getContext();
79
-		$order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->createItem();
79
+		$order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->createItem();
80 80
 
81
-		$this->stub->expects( $this->once() )->method( 'get' )
82
-			->will( $this->returnValue( $order ) );
81
+		$this->stub->expects($this->once())->method('get')
82
+			->will($this->returnValue($order));
83 83
 
84
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get() );
84
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get());
85 85
 	}
86 86
 
87 87
 
88 88
 	public function testSave()
89 89
 	{
90
-		$this->stub->expects( $this->once() )->method( 'save' );
90
+		$this->stub->expects($this->once())->method('save');
91 91
 
92 92
 		$this->object->save();
93 93
 	}
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 
96 96
 	public function testSetType()
97 97
 	{
98
-		$this->stub->expects( $this->once() )->method( 'setType' );
98
+		$this->stub->expects($this->once())->method('setType');
99 99
 
100
-		$this->object->setType( 'test' );
100
+		$this->object->setType('test');
101 101
 	}
102 102
 
103 103
 
104 104
 	public function testStore()
105 105
 	{
106
-		$this->stub->expects( $this->once() )->method( 'store' );
106
+		$this->stub->expects($this->once())->method('store');
107 107
 
108 108
 		$this->object->store();
109 109
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
 	public function testLoad()
113 113
 	{
114
-		$this->stub->expects( $this->once() )->method( 'load' );
114
+		$this->stub->expects($this->once())->method('load');
115 115
 
116 116
 		$this->object->load( -1 );
117 117
 	}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 	public function testAddProduct()
121 121
 	{
122
-		$this->stub->expects( $this->once() )->method( 'addProduct' );
122
+		$this->stub->expects($this->once())->method('addProduct');
123 123
 
124 124
 		$this->object->addProduct( -1 );
125 125
 	}
@@ -127,65 +127,65 @@  discard block
 block discarded – undo
127 127
 
128 128
 	public function testDeleteProduct()
129 129
 	{
130
-		$this->stub->expects( $this->once() )->method( 'deleteProduct' );
130
+		$this->stub->expects($this->once())->method('deleteProduct');
131 131
 
132
-		$this->object->deleteProduct( 0 );
132
+		$this->object->deleteProduct(0);
133 133
 	}
134 134
 
135 135
 
136 136
 	public function testEditProduct()
137 137
 	{
138
-		$this->stub->expects( $this->once() )->method( 'editProduct' );
138
+		$this->stub->expects($this->once())->method('editProduct');
139 139
 
140
-		$this->object->editProduct( 0, 1 );
140
+		$this->object->editProduct(0, 1);
141 141
 	}
142 142
 
143 143
 
144 144
 	public function testAddCoupon()
145 145
 	{
146
-		$this->stub->expects( $this->once() )->method( 'addCoupon' );
146
+		$this->stub->expects($this->once())->method('addCoupon');
147 147
 
148
-		$this->object->addCoupon( 'test' );
148
+		$this->object->addCoupon('test');
149 149
 	}
150 150
 
151 151
 
152 152
 	public function testDeleteCoupon()
153 153
 	{
154
-		$this->stub->expects( $this->once() )->method( 'deleteCoupon' );
154
+		$this->stub->expects($this->once())->method('deleteCoupon');
155 155
 
156
-		$this->object->deleteCoupon( 'test' );
156
+		$this->object->deleteCoupon('test');
157 157
 	}
158 158
 
159 159
 
160 160
 	public function testSetAddress()
161 161
 	{
162
-		$this->stub->expects( $this->once() )->method( 'setAddress' );
162
+		$this->stub->expects($this->once())->method('setAddress');
163 163
 
164
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null );
164
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null);
165 165
 	}
166 166
 
167 167
 
168 168
 	public function testSetService()
169 169
 	{
170
-		$this->stub->expects( $this->once() )->method( 'setService' );
170
+		$this->stub->expects($this->once())->method('setService');
171 171
 
172
-		$this->object->setService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, -1 );
172
+		$this->object->setService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, -1);
173 173
 	}
174 174
 
175 175
 
176 176
 	public function testGetController()
177 177
 	{
178
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
178
+		$result = $this->access('getController')->invokeArgs($this->object, []);
179 179
 
180
-		$this->assertSame( $this->stub, $result );
180
+		$this->assertSame($this->stub, $result);
181 181
 	}
182 182
 
183 183
 
184
-	protected function access( $name )
184
+	protected function access($name)
185 185
 	{
186
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' );
187
-		$method = $class->getMethod( $name );
188
-		$method->setAccessible( true );
186
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Basket\Decorator\Base');
187
+		$method = $class->getMethod($name);
188
+		$method->setAccessible(true);
189 189
 
190 190
 		return $method;
191 191
 	}
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Basket/Decorator/SelectTest.php 1 patch
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -19,217 +19,217 @@
 block discarded – undo
19 19
 	protected function setUp()
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22
-		$this->testItem = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' );
22
+		$this->testItem = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP');
23 23
 
24
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
25
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Select( $object, $this->context );
24
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
25
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Select($object, $this->context);
26 26
 	}
27 27
 
28 28
 
29 29
 	protected function tearDown()
30 30
 	{
31 31
 		$this->object->clear();
32
-		$this->context->getSession()->set( 'aimeos', [] );
32
+		$this->context->getSession()->set('aimeos', []);
33 33
 
34
-		unset( $this->object );
34
+		unset($this->object);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testAddDeleteProduct()
39 39
 	{
40 40
 		$basket = $this->object->get();
41
-		$this->object->addProduct( $this->testItem->getId(), 2 );
41
+		$this->object->addProduct($this->testItem->getId(), 2);
42 42
 
43
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
44
-		$this->assertEquals( 2, $basket->getProduct( 0 )->getQuantity() );
45
-		$this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() );
43
+		$this->assertEquals(1, count($basket->getProducts()));
44
+		$this->assertEquals(2, $basket->getProduct(0)->getQuantity());
45
+		$this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode());
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testAddProductNoSelection()
50 50
 	{
51
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
51
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
52 52
 
53
-		$this->object->addProduct( $item->getId(), 1 );
53
+		$this->object->addProduct($item->getId(), 1);
54 54
 
55
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
56
-		$this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() );
57
-		$this->assertEquals( 0, count( $this->object->get()->getProduct( 0 )->getProducts() ) );
55
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
56
+		$this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode());
57
+		$this->assertEquals(0, count($this->object->get()->getProduct(0)->getProducts()));
58 58
 	}
59 59
 
60 60
 
61 61
 	public function testAddProductVariant()
62 62
 	{
63
-		$attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
63
+		$attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext());
64 64
 
65 65
 		$search = $attributeManager->createSearch();
66
-		$search->setConditions( $search->compare( '==', 'attribute.code', array( 'xs', 'white' ) ) );
66
+		$search->setConditions($search->compare('==', 'attribute.code', array('xs', 'white')));
67 67
 
68
-		$attributes = $attributeManager->searchItems( $search );
68
+		$attributes = $attributeManager->searchItems($search);
69 69
 
70
-		if( count( $attributes ) === 0 ) {
71
-			throw new \RuntimeException( 'Attributes not found' );
70
+		if (count($attributes) === 0) {
71
+			throw new \RuntimeException('Attributes not found');
72 72
 		}
73 73
 
74 74
 
75
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
75
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
76 76
 
77
-		$this->object->addProduct( $item->getId(), 1, [], array_keys( $attributes ), [], [], [], 'default' );
77
+		$this->object->addProduct($item->getId(), 1, [], array_keys($attributes), [], [], [], 'default');
78 78
 
79
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
80
-		$this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() );
79
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
80
+		$this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode());
81 81
 	}
82 82
 
83 83
 
84 84
 	public function testAddProductVariantIncomplete()
85 85
 	{
86
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
86
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
87 87
 
88 88
 		$search = $attributeManager->createSearch();
89 89
 		$expr = array(
90
-			$search->compare( '==', 'attribute.domain', 'product' ),
91
-			$search->compare( '==', 'attribute.code', '30' ),
92
-			$search->compare( '==', 'attribute.type.code', 'length' ),
90
+			$search->compare('==', 'attribute.domain', 'product'),
91
+			$search->compare('==', 'attribute.code', '30'),
92
+			$search->compare('==', 'attribute.type.code', 'length'),
93 93
 		);
94
-		$search->setConditions( $search->combine( '&&', $expr ) );
94
+		$search->setConditions($search->combine('&&', $expr));
95 95
 
96
-		$attributes = $attributeManager->searchItems( $search );
96
+		$attributes = $attributeManager->searchItems($search);
97 97
 
98
-		if( count( $attributes ) === 0 ) {
99
-			throw new \RuntimeException( 'Attributes not found' );
98
+		if (count($attributes) === 0) {
99
+			throw new \RuntimeException('Attributes not found');
100 100
 		}
101 101
 
102 102
 
103
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' );
103
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST');
104 104
 
105
-		$this->object->addProduct( $item->getId(), 1, [], array_keys( $attributes ) );
105
+		$this->object->addProduct($item->getId(), 1, [], array_keys($attributes));
106 106
 
107
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
108
-		$this->assertEquals( 'U:TESTSUB02', $this->object->get()->getProduct( 0 )->getProductCode() );
109
-		$this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getAttributes() ) );
107
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
108
+		$this->assertEquals('U:TESTSUB02', $this->object->get()->getProduct(0)->getProductCode());
109
+		$this->assertEquals(2, count($this->object->get()->getProduct(0)->getAttributes()));
110 110
 	}
111 111
 
112 112
 
113 113
 	public function testAddProductVariantNonUnique()
114 114
 	{
115
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
115
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
116 116
 
117 117
 		$search = $attributeManager->createSearch();
118 118
 		$expr = array(
119
-			$search->compare( '==', 'attribute.domain', 'product' ),
120
-			$search->compare( '==', 'attribute.code', '30' ),
121
-			$search->compare( '==', 'attribute.type.code', 'width' ),
119
+			$search->compare('==', 'attribute.domain', 'product'),
120
+			$search->compare('==', 'attribute.code', '30'),
121
+			$search->compare('==', 'attribute.type.code', 'width'),
122 122
 		);
123
-		$search->setConditions( $search->combine( '&&', $expr ) );
123
+		$search->setConditions($search->combine('&&', $expr));
124 124
 
125
-		$attributes = $attributeManager->searchItems( $search );
125
+		$attributes = $attributeManager->searchItems($search);
126 126
 
127
-		if( count( $attributes ) === 0 ) {
128
-			throw new \RuntimeException( 'Attributes not found' );
127
+		if (count($attributes) === 0) {
128
+			throw new \RuntimeException('Attributes not found');
129 129
 		}
130 130
 
131 131
 
132
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' );
132
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST');
133 133
 
134
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
135
-		$this->object->addProduct( $item->getId(), 1, [], array_keys( $attributes ) );
134
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
135
+		$this->object->addProduct($item->getId(), 1, [], array_keys($attributes));
136 136
 	}
137 137
 
138 138
 
139 139
 	public function testAddProductVariantNotRequired()
140 140
 	{
141
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
141
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
142 142
 
143 143
 		$search = $attributeManager->createSearch();
144
-		$search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) );
144
+		$search->setConditions($search->compare('==', 'attribute.code', 'xs'));
145 145
 
146
-		$attributes = $attributeManager->searchItems( $search );
146
+		$attributes = $attributeManager->searchItems($search);
147 147
 
148
-		if( count( $attributes ) === 0 ) {
149
-			throw new \RuntimeException( 'Attribute not found' );
148
+		if (count($attributes) === 0) {
149
+			throw new \RuntimeException('Attribute not found');
150 150
 		}
151 151
 
152
-		$options = array( 'variant' => false );
152
+		$options = array('variant' => false);
153 153
 
154
-		$this->object->addProduct( $this->testItem->getId(), 1, $options, array_keys( $attributes ) );
154
+		$this->object->addProduct($this->testItem->getId(), 1, $options, array_keys($attributes));
155 155
 
156
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
157
-		$this->assertEquals( 'U:TESTP', $this->object->get()->getProduct( 0 )->getProductCode() );
156
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
157
+		$this->assertEquals('U:TESTP', $this->object->get()->getProduct(0)->getProductCode());
158 158
 	}
159 159
 
160 160
 
161 161
 	public function testAddProductEmptySelectionException()
162 162
 	{
163
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:noSel' );
163
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:noSel');
164 164
 
165
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
166
-		$this->object->addProduct( $item->getId(), 1 );
165
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
166
+		$this->object->addProduct($item->getId(), 1);
167 167
 	}
168 168
 
169 169
 
170 170
 	public function testAddProductSelectionWithPricelessItem()
171 171
 	{
172
-		$this->object->addProduct( $this->testItem->getId(), 1 );
172
+		$this->object->addProduct($this->testItem->getId(), 1);
173 173
 
174
-		$this->assertEquals( 'U:TESTPSUB01', $this->object->get()->getProduct( 0 )->getProductCode() );
174
+		$this->assertEquals('U:TESTPSUB01', $this->object->get()->getProduct(0)->getProductCode());
175 175
 	}
176 176
 
177 177
 
178 178
 	public function testAddProductConfigAttribute()
179 179
 	{
180
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
180
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
181 181
 
182 182
 		$search = $attributeManager->createSearch();
183
-		$search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) );
183
+		$search->setConditions($search->compare('==', 'attribute.code', 'xs'));
184 184
 
185
-		$attributes = $attributeManager->searchItems( $search );
185
+		$attributes = $attributeManager->searchItems($search);
186 186
 
187
-		if( empty( $attributes ) ) {
188
-			throw new \RuntimeException( 'Attribute not found' );
187
+		if (empty($attributes)) {
188
+			throw new \RuntimeException('Attribute not found');
189 189
 		}
190 190
 
191
-		$this->object->addProduct( $this->testItem->getId(), 1, [], [], array_keys( $attributes ) );
191
+		$this->object->addProduct($this->testItem->getId(), 1, [], [], array_keys($attributes));
192 192
 		$basket = $this->object->get();
193 193
 
194
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
195
-		$this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() );
196
-		$this->assertEquals( 'xs', $basket->getProduct( 0 )->getAttribute( 'size', 'config' ) );
194
+		$this->assertEquals(1, count($basket->getProducts()));
195
+		$this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode());
196
+		$this->assertEquals('xs', $basket->getProduct(0)->getAttribute('size', 'config'));
197 197
 	}
198 198
 
199 199
 
200 200
 	public function testAddProductHiddenAttribute()
201 201
 	{
202
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
202
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
203 203
 
204 204
 		$search = $attributeManager->createSearch();
205 205
 		$expr = array(
206
-			$search->compare( '==', 'attribute.code', '29' ),
207
-			$search->compare( '==', 'attribute.type.code', 'width' ),
206
+			$search->compare('==', 'attribute.code', '29'),
207
+			$search->compare('==', 'attribute.type.code', 'width'),
208 208
 		);
209
-		$search->setConditions( $search->combine( '&&', $expr ) );
209
+		$search->setConditions($search->combine('&&', $expr));
210 210
 
211
-		$attributes = $attributeManager->searchItems( $search );
211
+		$attributes = $attributeManager->searchItems($search);
212 212
 
213
-		if( empty( $attributes ) ) {
214
-			throw new \RuntimeException( 'Attribute not found' );
213
+		if (empty($attributes)) {
214
+			throw new \RuntimeException('Attribute not found');
215 215
 		}
216 216
 
217
-		$this->object->addProduct( $this->testItem->getId(), 1, [], [], [], array_keys( $attributes ) );
217
+		$this->object->addProduct($this->testItem->getId(), 1, [], [], [], array_keys($attributes));
218 218
 
219 219
 		$basket = $this->object->get();
220
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
220
+		$this->assertEquals(1, count($basket->getProducts()));
221 221
 
222
-		$product = $basket->getProduct( 0 );
223
-		$this->assertEquals( 'U:TESTPSUB01', $product->getProductCode() );
222
+		$product = $basket->getProduct(0);
223
+		$this->assertEquals('U:TESTPSUB01', $product->getProductCode());
224 224
 
225 225
 		$attributes = $product->getAttributes();
226
-		$this->assertEquals( 1, count( $attributes ) );
226
+		$this->assertEquals(1, count($attributes));
227 227
 
228
-		if( ( $attribute = reset( $attributes ) ) === false ) {
229
-			throw new \RuntimeException( 'No attribute' );
228
+		if (($attribute = reset($attributes)) === false) {
229
+			throw new \RuntimeException('No attribute');
230 230
 		}
231 231
 
232
-		$this->assertEquals( 'hidden', $attribute->getType() );
233
-		$this->assertEquals( '29', $product->getAttribute( 'width', 'hidden' ) );
232
+		$this->assertEquals('hidden', $attribute->getType());
233
+		$this->assertEquals('29', $product->getAttribute('width', 'hidden'));
234 234
 	}
235 235
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/StandardTest.php 1 patch
Spacing   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -19,112 +19,112 @@  discard block
 block discarded – undo
19 19
 	public static function setUpBeforeClass()
20 20
 	{
21 21
 		$context = \TestHelperFrontend::getContext();
22
-		self::$testItem = \Aimeos\MShop\Factory::createManager( $context, 'product' )->findItem( 'U:TESTP' );
22
+		self::$testItem = \Aimeos\MShop\Factory::createManager($context, 'product')->findItem('U:TESTP');
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function setUp()
27 27
 	{
28
-		\Aimeos\MShop\Factory::setCache( true );
28
+		\Aimeos\MShop\Factory::setCache(true);
29 29
 
30 30
 		$this->context = \TestHelperFrontend::getContext();
31
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
31
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
32 32
 	}
33 33
 
34 34
 
35 35
 	protected function tearDown()
36 36
 	{
37
-		\Aimeos\MShop\Factory::setCache( false );
37
+		\Aimeos\MShop\Factory::setCache(false);
38 38
 		\Aimeos\MShop\Factory::clear();
39 39
 
40 40
 		$this->object->clear();
41
-		$this->context->getSession()->set( 'aimeos', [] );
41
+		$this->context->getSession()->set('aimeos', []);
42 42
 
43
-		unset( $this->context, $this->object );
43
+		unset($this->context, $this->object);
44 44
 	}
45 45
 
46 46
 
47 47
 	public function testClear()
48 48
 	{
49
-		$this->object->addProduct( self::$testItem->getId(), 2 );
49
+		$this->object->addProduct(self::$testItem->getId(), 2);
50 50
 		$this->object->clear();
51 51
 
52
-		$this->assertEquals( 0, count( $this->object->get()->getProducts() ) );
52
+		$this->assertEquals(0, count($this->object->get()->getProducts()));
53 53
 	}
54 54
 
55 55
 
56 56
 	public function testGet()
57 57
 	{
58
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get() );
58
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get());
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testSave()
63 63
 	{
64
-		$stub = $this->getMockBuilder( '\Aimeos\MShop\Order\Manager\Base\Standard' )
65
-			->setConstructorArgs( [$this->context] )
66
-			->setMethods( ['setSession'] )
64
+		$stub = $this->getMockBuilder('\Aimeos\MShop\Order\Manager\Base\Standard')
65
+			->setConstructorArgs([$this->context])
66
+			->setMethods(['setSession'])
67 67
 			->getMock();
68 68
 
69
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $stub );
69
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $stub);
70 70
 
71
-		$stub->expects( $this->exactly( 2 ) )->method( 'setSession' );
71
+		$stub->expects($this->exactly(2))->method('setSession');
72 72
 
73
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
74
-		$object->addProduct( self::$testItem->getId(), 2 );
73
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
74
+		$object->addProduct(self::$testItem->getId(), 2);
75 75
 		$object->save();
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testSetType()
80 80
 	{
81
-		$this->assertInstanceOf( '\Aimeos\Controller\Frontend\Basket\Iface', $this->object->setType( 'test' ) );
81
+		$this->assertInstanceOf('\Aimeos\Controller\Frontend\Basket\Iface', $this->object->setType('test'));
82 82
 	}
83 83
 
84 84
 
85 85
 	public function testStore()
86 86
 	{
87
-		$stub = $this->getMockBuilder( '\Aimeos\MShop\Order\Manager\Base\Standard' )
88
-			->setConstructorArgs( [$this->context] )
89
-			->setMethods( ['store'] )
87
+		$stub = $this->getMockBuilder('\Aimeos\MShop\Order\Manager\Base\Standard')
88
+			->setConstructorArgs([$this->context])
89
+			->setMethods(['store'])
90 90
 			->getMock();
91 91
 
92
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $stub );
92
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $stub);
93 93
 
94
-		$stub->expects( $this->once() )->method( 'store' );
94
+		$stub->expects($this->once())->method('store');
95 95
 
96
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
96
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
97 97
 		$object->store();
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testStoreLimit()
102 102
 	{
103
-		$this->context->setEditor( 'core:unittest' );
103
+		$this->context->setEditor('core:unittest');
104 104
 		$config = $this->context->getConfig();
105
-		$config->set( 'controller/frontend/basket/limit-count', 0 );
106
-		$config->set( 'controller/frontend/basket/limit-seconds', 86400 * 365 );
105
+		$config->set('controller/frontend/basket/limit-count', 0);
106
+		$config->set('controller/frontend/basket/limit-seconds', 86400 * 365);
107 107
 
108
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
108
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
109 109
 
110
-		$this->expectException( '\Aimeos\Controller\Frontend\Basket\Exception' );
110
+		$this->expectException('\Aimeos\Controller\Frontend\Basket\Exception');
111 111
 		$object->store();
112 112
 	}
113 113
 
114 114
 
115 115
 	public function testLoad()
116 116
 	{
117
-		$stub = $this->getMockBuilder( '\Aimeos\MShop\Order\Manager\Base\Standard' )
118
-			->setConstructorArgs( [$this->context] )
119
-			->setMethods( ['load'] )
117
+		$stub = $this->getMockBuilder('\Aimeos\MShop\Order\Manager\Base\Standard')
118
+			->setConstructorArgs([$this->context])
119
+			->setMethods(['load'])
120 120
 			->getMock();
121 121
 
122
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $stub );
122
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $stub);
123 123
 
124
-		$stub->expects( $this->once() )->method( 'load' )
125
-			->will( $this->returnValue( $stub->createItem() ) );
124
+		$stub->expects($this->once())->method('load')
125
+			->will($this->returnValue($stub->createItem()));
126 126
 
127
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
127
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
128 128
 		$object->load( -1 );
129 129
 	}
130 130
 
@@ -132,250 +132,250 @@  discard block
 block discarded – undo
132 132
 	public function testAddDeleteProduct()
133 133
 	{
134 134
 		$basket = $this->object->get();
135
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
135
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
136 136
 
137
-		$this->object->addProduct( $item->getId(), 2, [], [], [], [], [], 'default' );
138
-		$item2 = $this->object->get()->getProduct( 0 );
139
-		$this->object->deleteProduct( 0 );
137
+		$this->object->addProduct($item->getId(), 2, [], [], [], [], [], 'default');
138
+		$item2 = $this->object->get()->getProduct(0);
139
+		$this->object->deleteProduct(0);
140 140
 
141
-		$this->assertEquals( 0, count( $basket->getProducts() ) );
142
-		$this->assertEquals( 'CNC', $item2->getProductCode() );
141
+		$this->assertEquals(0, count($basket->getProducts()));
142
+		$this->assertEquals('CNC', $item2->getProductCode());
143 143
 	}
144 144
 
145 145
 
146 146
 	public function testAddProductCustomAttribute()
147 147
 	{
148
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
148
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
149 149
 
150 150
 		$search = $attributeManager->createSearch();
151 151
 		$expr = array(
152
-			$search->compare( '==', 'attribute.code', 'custom' ),
153
-			$search->compare( '==', 'attribute.type.code', 'date' ),
152
+			$search->compare('==', 'attribute.code', 'custom'),
153
+			$search->compare('==', 'attribute.type.code', 'date'),
154 154
 		);
155
-		$search->setConditions( $search->combine( '&&', $expr ) );
155
+		$search->setConditions($search->combine('&&', $expr));
156 156
 
157
-		$attributes = $attributeManager->searchItems( $search );
157
+		$attributes = $attributeManager->searchItems($search);
158 158
 
159
-		if( ( $attrItem = reset( $attributes ) ) === false ) {
160
-			throw new \RuntimeException( 'Attribute not found' );
159
+		if (($attrItem = reset($attributes)) === false) {
160
+			throw new \RuntimeException('Attribute not found');
161 161
 		}
162 162
 
163
-		$attrValues = array( $attrItem->getId() => '2000-01-01' );
163
+		$attrValues = array($attrItem->getId() => '2000-01-01');
164 164
 
165
-		$this->object->addProduct( self::$testItem->getId(), 1, [], [], [], [], $attrValues );
165
+		$this->object->addProduct(self::$testItem->getId(), 1, [], [], [], [], $attrValues);
166 166
 		$basket = $this->object->get();
167 167
 
168
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
169
-		$this->assertEquals( '2000-01-01', $basket->getProduct( 0 )->getAttribute( 'date', 'custom' ) );
168
+		$this->assertEquals(1, count($basket->getProducts()));
169
+		$this->assertEquals('2000-01-01', $basket->getProduct(0)->getAttribute('date', 'custom'));
170 170
 	}
171 171
 
172 172
 
173 173
 	public function testAddProductAttributeNotAssigned()
174 174
 	{
175
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
175
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
176 176
 
177 177
 		$search = $attributeManager->createSearch();
178 178
 		$expr = array(
179
-			$search->compare( '==', 'attribute.code', '30' ),
180
-			$search->compare( '==', 'attribute.type.code', 'width' ),
179
+			$search->compare('==', 'attribute.code', '30'),
180
+			$search->compare('==', 'attribute.type.code', 'width'),
181 181
 		);
182
-		$search->setConditions( $search->combine( '&&', $expr ) );
182
+		$search->setConditions($search->combine('&&', $expr));
183 183
 
184
-		$attribute = $attributeManager->searchItems( $search );
184
+		$attribute = $attributeManager->searchItems($search);
185 185
 
186
-		if( empty( $attribute ) ) {
187
-			throw new \RuntimeException( 'Attribute not found' );
186
+		if (empty($attribute)) {
187
+			throw new \RuntimeException('Attribute not found');
188 188
 		}
189 189
 
190
-		$hiddenAttrIds = array_keys( $attribute );
191
-		$configAttrIds = array_keys( $attribute );
190
+		$hiddenAttrIds = array_keys($attribute);
191
+		$configAttrIds = array_keys($attribute);
192 192
 
193
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
194
-		$this->object->addProduct( self::$testItem->getId(), 1, [], [], $configAttrIds, $hiddenAttrIds );
193
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
194
+		$this->object->addProduct(self::$testItem->getId(), 1, [], [], $configAttrIds, $hiddenAttrIds);
195 195
 	}
196 196
 
197 197
 
198 198
 	public function testAddProductNegativeQuantityException()
199 199
 	{
200
-		$this->expectException( '\\Aimeos\\MShop\\Order\\Exception' );
201
-		$this->object->addProduct( self::$testItem->getId(), -1 );
200
+		$this->expectException('\\Aimeos\\MShop\\Order\\Exception');
201
+		$this->object->addProduct(self::$testItem->getId(), -1);
202 202
 	}
203 203
 
204 204
 
205 205
 	public function testAddProductNoPriceException()
206 206
 	{
207
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'MNOP' );
207
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('MNOP');
208 208
 
209
-		$this->expectException( '\\Aimeos\\MShop\\Price\\Exception' );
210
-		$this->object->addProduct( $item->getId(), 1 );
209
+		$this->expectException('\\Aimeos\\MShop\\Price\\Exception');
210
+		$this->object->addProduct($item->getId(), 1);
211 211
 	}
212 212
 
213 213
 
214 214
 	public function testAddProductConfigAttributeException()
215 215
 	{
216
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
217
-		$this->object->addProduct( self::$testItem->getId(), 1, [], [], array( -1 ) );
216
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
217
+		$this->object->addProduct(self::$testItem->getId(), 1, [], [], array( -1 ));
218 218
 	}
219 219
 
220 220
 
221 221
 	public function testAddProductLowQuantityPriceException()
222 222
 	{
223
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'IJKL' );
223
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('IJKL');
224 224
 
225
-		$this->expectException( '\\Aimeos\\MShop\\Price\\Exception' );
226
-		$this->object->addProduct( $item->getId(), 1 );
225
+		$this->expectException('\\Aimeos\\MShop\\Price\\Exception');
226
+		$this->object->addProduct($item->getId(), 1);
227 227
 	}
228 228
 
229 229
 
230 230
 	public function testAddProductHigherQuantities()
231 231
 	{
232
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'IJKL' );
232
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('IJKL');
233 233
 
234
-		$this->object->addProduct( $item->getId(), 2, [], [], [], [], [], 'unit_type3' );
234
+		$this->object->addProduct($item->getId(), 2, [], [], [], [], [], 'unit_type3');
235 235
 
236
-		$this->assertEquals( 2, $this->object->get()->getProduct( 0 )->getQuantity() );
237
-		$this->assertEquals( 'IJKL', $this->object->get()->getProduct( 0 )->getProductCode() );
236
+		$this->assertEquals(2, $this->object->get()->getProduct(0)->getQuantity());
237
+		$this->assertEquals('IJKL', $this->object->get()->getProduct(0)->getProductCode());
238 238
 	}
239 239
 
240 240
 
241 241
 	public function testDeleteProductFlagError()
242 242
 	{
243
-		$this->object->addProduct( self::$testItem->getId(), 2 );
243
+		$this->object->addProduct(self::$testItem->getId(), 2);
244 244
 
245
-		$item = $this->object->get()->getProduct( 0 );
246
-		$item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE );
245
+		$item = $this->object->get()->getProduct(0);
246
+		$item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE);
247 247
 
248
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
249
-		$this->object->deleteProduct( 0 );
248
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
249
+		$this->object->deleteProduct(0);
250 250
 	}
251 251
 
252 252
 
253 253
 	public function testEditProduct()
254 254
 	{
255
-		$this->object->addProduct( self::$testItem->getId(), 1 );
255
+		$this->object->addProduct(self::$testItem->getId(), 1);
256 256
 
257
-		$item = $this->object->get()->getProduct( 0 );
258
-		$this->assertEquals( 1, $item->getQuantity() );
257
+		$item = $this->object->get()->getProduct(0);
258
+		$this->assertEquals(1, $item->getQuantity());
259 259
 
260
-		$this->object->editProduct( 0, 4 );
260
+		$this->object->editProduct(0, 4);
261 261
 
262
-		$item = $this->object->get()->getProduct( 0 );
263
-		$this->assertEquals( 4, $item->getQuantity() );
264
-		$this->assertEquals( 'U:TESTP', $item->getProductCode() );
262
+		$item = $this->object->get()->getProduct(0);
263
+		$this->assertEquals(4, $item->getQuantity());
264
+		$this->assertEquals('U:TESTP', $item->getProductCode());
265 265
 	}
266 266
 
267 267
 
268 268
 	public function testEditProductAttributes()
269 269
 	{
270
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
270
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
271 271
 
272 272
 		$search = $attributeManager->createSearch();
273 273
 		$conditions = array(
274
-			$search->compare( '==', 'attribute.domain', 'product' ),
275
-			$search->combine( '||', array(
276
-				$search->combine( '&&', array(
277
-					$search->compare( '==', 'attribute.code', 'xs' ),
278
-					$search->compare( '==', 'attribute.type.code', 'size' ),
279
-				) ),
280
-				$search->combine( '&&', array(
281
-					$search->compare( '==', 'attribute.code', 'white' ),
282
-					$search->compare( '==', 'attribute.type.code', 'color' ),
283
-				) ),
284
-			) )
274
+			$search->compare('==', 'attribute.domain', 'product'),
275
+			$search->combine('||', array(
276
+				$search->combine('&&', array(
277
+					$search->compare('==', 'attribute.code', 'xs'),
278
+					$search->compare('==', 'attribute.type.code', 'size'),
279
+				)),
280
+				$search->combine('&&', array(
281
+					$search->compare('==', 'attribute.code', 'white'),
282
+					$search->compare('==', 'attribute.type.code', 'color'),
283
+				)),
284
+			))
285 285
 		);
286
-		$search->setConditions( $search->combine( '&&', $conditions ) );
287
-		$attributes = $attributeManager->searchItems( $search );
286
+		$search->setConditions($search->combine('&&', $conditions));
287
+		$attributes = $attributeManager->searchItems($search);
288 288
 
289
-		if( ( $attribute = reset( $attributes ) ) === false ) {
290
-			throw new \RuntimeException( 'No attributes available' );
289
+		if (($attribute = reset($attributes)) === false) {
290
+			throw new \RuntimeException('No attributes available');
291 291
 		}
292 292
 
293 293
 
294
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' );
294
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP');
295 295
 
296
-		$this->object->addProduct( $item->getId(), 1, [], [], array_keys( $attributes ) );
297
-		$this->object->editProduct( 0, 4 );
296
+		$this->object->addProduct($item->getId(), 1, [], [], array_keys($attributes));
297
+		$this->object->editProduct(0, 4);
298 298
 
299
-		$item = $this->object->get()->getProduct( 0 );
300
-		$this->assertEquals( 2, count( $item->getAttributes() ) );
301
-		$this->assertEquals( 4, $item->getQuantity() );
299
+		$item = $this->object->get()->getProduct(0);
300
+		$this->assertEquals(2, count($item->getAttributes()));
301
+		$this->assertEquals(4, $item->getQuantity());
302 302
 
303 303
 
304
-		$this->object->editProduct( 0, 3, [], array( $attribute->getType() ) );
304
+		$this->object->editProduct(0, 3, [], array($attribute->getType()));
305 305
 
306
-		$item = $this->object->get()->getProduct( 0 );
307
-		$this->assertEquals( 3, $item->getQuantity() );
308
-		$this->assertEquals( 1, count( $item->getAttributes() ) );
309
-		$this->assertEquals( 'U:TESTP', $item->getProductCode() );
306
+		$item = $this->object->get()->getProduct(0);
307
+		$this->assertEquals(3, $item->getQuantity());
308
+		$this->assertEquals(1, count($item->getAttributes()));
309
+		$this->assertEquals('U:TESTP', $item->getProductCode());
310 310
 	}
311 311
 
312 312
 
313 313
 	public function testEditProductFlagError()
314 314
 	{
315
-		$this->object->addProduct( self::$testItem->getId(), 2 );
315
+		$this->object->addProduct(self::$testItem->getId(), 2);
316 316
 
317
-		$item = $this->object->get()->getProduct( 0 );
318
-		$item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE );
317
+		$item = $this->object->get()->getProduct(0);
318
+		$item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE);
319 319
 
320
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
321
-		$this->object->editProduct( 0, 4 );
320
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
321
+		$this->object->editProduct(0, 4);
322 322
 	}
323 323
 
324 324
 
325 325
 	public function testAddCoupon()
326 326
 	{
327
-		$this->object->addProduct( self::$testItem->getId(), 2 );
328
-		$this->object->addCoupon( 'GHIJ' );
327
+		$this->object->addProduct(self::$testItem->getId(), 2);
328
+		$this->object->addCoupon('GHIJ');
329 329
 
330 330
 		$basket = $this->object->get();
331 331
 
332
-		$this->assertEquals( 1, count( $basket->getCoupons() ) );
332
+		$this->assertEquals(1, count($basket->getCoupons()));
333 333
 	}
334 334
 
335 335
 
336 336
 	public function testAddCouponInvalidCode()
337 337
 	{
338
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
339
-		$this->object->addCoupon( 'invalid' );
338
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
339
+		$this->object->addCoupon('invalid');
340 340
 	}
341 341
 
342 342
 
343 343
 	public function testAddCouponMissingRequirements()
344 344
 	{
345
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
346
-		$this->object->addCoupon( 'OPQR' );
345
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
346
+		$this->object->addCoupon('OPQR');
347 347
 	}
348 348
 
349 349
 
350 350
 	public function testDeleteCoupon()
351 351
 	{
352
-		$this->object->addProduct( self::$testItem->getId(), 2 );
353
-		$this->object->addCoupon( '90AB' );
354
-		$this->object->deleteCoupon( '90AB' );
352
+		$this->object->addProduct(self::$testItem->getId(), 2);
353
+		$this->object->addCoupon('90AB');
354
+		$this->object->deleteCoupon('90AB');
355 355
 
356 356
 		$basket = $this->object->get();
357 357
 
358
-		$this->assertEquals( 0, count( $basket->getCoupons() ) );
358
+		$this->assertEquals(0, count($basket->getCoupons()));
359 359
 	}
360 360
 
361 361
 
362 362
 	public function testSetAddressDelete()
363 363
 	{
364
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null );
364
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null);
365 365
 
366
-		$this->expectException( '\Aimeos\MShop\Order\Exception' );
367
-		$this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
366
+		$this->expectException('\Aimeos\MShop\Order\Exception');
367
+		$this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
368 368
 	}
369 369
 
370 370
 
371 371
 	public function testSetBillingAddressByItem()
372 372
 	{
373
-		$item = $this->getAddress( 'Example company' );
373
+		$item = $this->getAddress('Example company');
374 374
 
375
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item );
375
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item);
376 376
 
377
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
378
-		$this->assertEquals( 'Example company', $address->getCompany() );
377
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
378
+		$this->assertEquals('Example company', $address->getCompany());
379 379
 	}
380 380
 
381 381
 
@@ -403,37 +403,37 @@  discard block
 block discarded – undo
403 403
 			'order.base.address.flag' => 0,
404 404
 		);
405 405
 
406
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture );
406
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture);
407 407
 
408
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
409
-		$this->assertEquals( 'Example company', $address->getCompany() );
410
-		$this->assertEquals( 'Dr.', $address->getTitle() );
411
-		$this->assertEquals( 'firstunit', $address->getFirstname() );
408
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
409
+		$this->assertEquals('Example company', $address->getCompany());
410
+		$this->assertEquals('Dr.', $address->getTitle());
411
+		$this->assertEquals('firstunit', $address->getFirstname());
412 412
 	}
413 413
 
414 414
 
415 415
 	public function testSetBillingAddressByArrayError()
416 416
 	{
417
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
418
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array( 'error' => false ) );
417
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
418
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array('error' => false));
419 419
 	}
420 420
 
421 421
 
422 422
 	public function testSetBillingAddressParameterError()
423 423
 	{
424
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
425
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error' );
424
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
425
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error');
426 426
 	}
427 427
 
428 428
 
429 429
 	public function testSetDeliveryAddressByItem()
430 430
 	{
431
-		$item = $this->getAddress( 'Example company' );
431
+		$item = $this->getAddress('Example company');
432 432
 
433
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item );
433
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item);
434 434
 
435
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY );
436
-		$this->assertEquals( 'Example company', $address->getCompany() );
435
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY);
436
+		$this->assertEquals('Example company', $address->getCompany());
437 437
 	}
438 438
 
439 439
 
@@ -460,119 +460,119 @@  discard block
 block discarded – undo
460 460
 			'order.base.address.website' => 'www.example.com',
461 461
 			'order.base.address.flag' => 0,
462 462
 		);
463
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture );
463
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture);
464 464
 
465
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY );
466
-		$this->assertEquals( 'Example company', $address->getCompany() );
467
-		$this->assertEquals( 'Dr.', $address->getTitle() );
468
-		$this->assertEquals( 'firstunit', $address->getFirstname() );
465
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY);
466
+		$this->assertEquals('Example company', $address->getCompany());
467
+		$this->assertEquals('Dr.', $address->getTitle());
468
+		$this->assertEquals('firstunit', $address->getFirstname());
469 469
 	}
470 470
 
471 471
 
472 472
 	public function testSetDeliveryAddressByArrayError()
473 473
 	{
474
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
475
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array( 'error' => false ) );
474
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
475
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array('error' => false));
476 476
 	}
477 477
 
478 478
 
479 479
 	public function testSetDeliveryAddressTypeError()
480 480
 	{
481
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
482
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error' );
481
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
482
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error');
483 483
 	}
484 484
 
485 485
 
486 486
 	public function testSetServicePayment()
487 487
 	{
488
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
489
-		$service = $manager->findItem( 'unitpaymentcode', [], 'service', 'payment' );
488
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
489
+		$service = $manager->findItem('unitpaymentcode', [], 'service', 'payment');
490 490
 
491
-		$this->object->setService( 'payment', $service->getId(), [] );
492
-		$this->assertEquals( 'unitpaymentcode', $this->object->get()->getService( 'payment' )->getCode() );
491
+		$this->object->setService('payment', $service->getId(), []);
492
+		$this->assertEquals('unitpaymentcode', $this->object->get()->getService('payment')->getCode());
493 493
 
494
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
495
-		$this->object->setService( 'payment', $service->getId(), array( 'prepay' => true ) );
494
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
495
+		$this->object->setService('payment', $service->getId(), array('prepay' => true));
496 496
 	}
497 497
 
498 498
 
499 499
 	public function testSetDeliveryOption()
500 500
 	{
501
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
502
-		$service = $manager->findItem( 'unitcode', [], 'service', 'delivery' );
501
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
502
+		$service = $manager->findItem('unitcode', [], 'service', 'delivery');
503 503
 
504
-		$this->object->setService( 'delivery', $service->getId(), [] );
505
-		$this->assertEquals( 'unitcode', $this->object->get()->getService( 'delivery' )->getCode() );
504
+		$this->object->setService('delivery', $service->getId(), []);
505
+		$this->assertEquals('unitcode', $this->object->get()->getService('delivery')->getCode());
506 506
 
507
-		$this->expectException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
508
-		$this->object->setService( 'delivery', $service->getId(), array( 'fast shipping' => true, 'air shipping' => false ) );
507
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
508
+		$this->object->setService('delivery', $service->getId(), array('fast shipping' => true, 'air shipping' => false));
509 509
 	}
510 510
 
511 511
 
512 512
 	public function testCheckLocale()
513 513
 	{
514
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
515
-		$payment = $manager->findItem( 'unitpaymentcode', [], 'service', 'payment' );
516
-		$delivery = $manager->findItem( 'unitcode', [], 'service', 'delivery' );
514
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
515
+		$payment = $manager->findItem('unitpaymentcode', [], 'service', 'payment');
516
+		$delivery = $manager->findItem('unitcode', [], 'service', 'delivery');
517 517
 
518
-		$this->object->addProduct( self::$testItem->getId(), 2 );
519
-		$this->object->addCoupon( 'OPQR' );
518
+		$this->object->addProduct(self::$testItem->getId(), 2);
519
+		$this->object->addCoupon('OPQR');
520 520
 
521
-		$this->object->setService( 'payment', $payment->getId() );
522
-		$this->object->setService( 'delivery', $delivery->getId() );
521
+		$this->object->setService('payment', $payment->getId());
522
+		$this->object->setService('delivery', $delivery->getId());
523 523
 
524 524
 		$basket = $this->object->get();
525 525
 		$price = $basket->getPrice();
526 526
 
527
-		foreach( $basket->getProducts() as $product )
527
+		foreach ($basket->getProducts() as $product)
528 528
 		{
529
-			$this->assertEquals( 2, $product->getQuantity() );
530
-			$product->getPrice()->setCurrencyId( 'CHF' );
529
+			$this->assertEquals(2, $product->getQuantity());
530
+			$product->getPrice()->setCurrencyId('CHF');
531 531
 		}
532 532
 
533
-		$basket->getService( 'delivery' )->getPrice()->setCurrencyId( 'CHF' );
534
-		$basket->getService( 'payment' )->getPrice()->setCurrencyId( 'CHF' );
535
-		$basket->getLocale()->setCurrencyId( 'CHF' );
536
-		$price->setCurrencyId( 'CHF' );
533
+		$basket->getService('delivery')->getPrice()->setCurrencyId('CHF');
534
+		$basket->getService('payment')->getPrice()->setCurrencyId('CHF');
535
+		$basket->getLocale()->setCurrencyId('CHF');
536
+		$price->setCurrencyId('CHF');
537 537
 
538
-		$this->context->getLocale()->setCurrencyId( 'CHF' );
539
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress( 'Example company' ) );
538
+		$this->context->getLocale()->setCurrencyId('CHF');
539
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress('Example company'));
540 540
 
541
-		$this->context->getSession()->set( 'aimeos/basket/currency', 'CHF' );
542
-		$this->context->getLocale()->setCurrencyId( 'EUR' );
541
+		$this->context->getSession()->set('aimeos/basket/currency', 'CHF');
542
+		$this->context->getLocale()->setCurrencyId('EUR');
543 543
 
544
-		$this->context->getSession()->set( 'aimeos/basket/content-unittest-en-EUR-', null );
544
+		$this->context->getSession()->set('aimeos/basket/content-unittest-en-EUR-', null);
545 545
 
546
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
546
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
547 547
 		$basket = $object->get();
548 548
 
549
-		foreach( $basket->getProducts() as $product )
549
+		foreach ($basket->getProducts() as $product)
550 550
 		{
551
-			$this->assertEquals( 'EUR', $product->getPrice()->getCurrencyId() );
552
-			$this->assertEquals( 2, $product->getQuantity() );
551
+			$this->assertEquals('EUR', $product->getPrice()->getCurrencyId());
552
+			$this->assertEquals(2, $product->getQuantity());
553 553
 		}
554 554
 
555
-		$this->assertEquals( 'EUR', $basket->getService( 'payment' )->getPrice()->getCurrencyId() );
556
-		$this->assertEquals( 'EUR', $basket->getService( 'delivery' )->getPrice()->getCurrencyId() );
557
-		$this->assertEquals( 'EUR', $basket->getLocale()->getCurrencyId() );
558
-		$this->assertEquals( 'EUR', $basket->getPrice()->getCurrencyId() );
555
+		$this->assertEquals('EUR', $basket->getService('payment')->getPrice()->getCurrencyId());
556
+		$this->assertEquals('EUR', $basket->getService('delivery')->getPrice()->getCurrencyId());
557
+		$this->assertEquals('EUR', $basket->getLocale()->getCurrencyId());
558
+		$this->assertEquals('EUR', $basket->getPrice()->getCurrencyId());
559 559
 	}
560 560
 
561 561
 
562 562
 	/**
563 563
 	 * @param string $company
564 564
 	 */
565
-	protected function getAddress( $company )
565
+	protected function getAddress($company)
566 566
 	{
567
-		$customer = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelperFrontend::getContext(), 'Standard' );
568
-		$addressManager = $customer->getSubManager( 'address', 'Standard' );
567
+		$customer = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelperFrontend::getContext(), 'Standard');
568
+		$addressManager = $customer->getSubManager('address', 'Standard');
569 569
 
570 570
 		$search = $addressManager->createSearch();
571
-		$search->setConditions( $search->compare( '==', 'customer.address.company', $company ) );
572
-		$items = $addressManager->searchItems( $search );
571
+		$search->setConditions($search->compare('==', 'customer.address.company', $company));
572
+		$items = $addressManager->searchItems($search);
573 573
 
574
-		if( ( $item = reset( $items ) ) === false ) {
575
-			throw new \RuntimeException( sprintf( 'No address item with company "%1$s" found', $company ) );
574
+		if (($item = reset($items)) === false) {
575
+			throw new \RuntimeException(sprintf('No address item with company "%1$s" found', $company));
576 576
 		}
577 577
 
578 578
 		return $item;
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
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->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
28
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
27
+		$this->expectException('\\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->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->expectException('\\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->expectException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->expectException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.