@@ -20,95 +20,95 @@ |
||
| 20 | 20 | { |
| 21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
| 22 | 22 | |
| 23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Catalog\Standard' ) |
|
| 23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Catalog\Standard') |
|
| 24 | 24 | ->disableOriginalConstructor() |
| 25 | 25 | ->getMock(); |
| 26 | 26 | |
| 27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Catalog\Decorator\Base' ) |
|
| 28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
| 27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Catalog\Decorator\Base') |
|
| 28 | + ->setConstructorArgs([$this->stub, $this->context]) |
|
| 29 | 29 | ->getMockForAbstractClass(); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | protected function tearDown() |
| 34 | 34 | { |
| 35 | - unset( $this->context, $this->object, $this->stub ); |
|
| 35 | + unset($this->context, $this->object, $this->stub); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | public function testConstructException() |
| 40 | 40 | { |
| 41 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock(); |
|
| 41 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock(); |
|
| 42 | 42 | |
| 43 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' ); |
|
| 43 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Exception'); |
|
| 44 | 44 | |
| 45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Catalog\Decorator\Base' ) |
|
| 46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
| 45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Catalog\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\Catalog\Standard' ) |
|
| 53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Catalog\Standard') |
|
| 54 | 54 | ->disableOriginalConstructor() |
| 55 | - ->setMethods( ['invalid'] ) |
|
| 55 | + ->setMethods(['invalid']) |
|
| 56 | 56 | ->getMock(); |
| 57 | 57 | |
| 58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Catalog\Decorator\Base' ) |
|
| 59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
| 58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Catalog\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, 'catalog' )->createSearch(); |
|
| 70 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'catalog')->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 testGetPath() |
| 80 | 80 | { |
| 81 | - $this->stub->expects( $this->once() )->method( 'getPath' ) |
|
| 82 | - ->will( $this->returnValue( [] ) ); |
|
| 81 | + $this->stub->expects($this->once())->method('getPath') |
|
| 82 | + ->will($this->returnValue([])); |
|
| 83 | 83 | |
| 84 | - $this->assertEquals( [], $this->object->getPath( -1 ) ); |
|
| 84 | + $this->assertEquals([], $this->object->getPath( -1 )); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | public function testGetTree() |
| 89 | 89 | { |
| 90 | - $catItem = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' )->createItem(); |
|
| 90 | + $catItem = \Aimeos\MShop\Factory::createManager($this->context, 'catalog')->createItem(); |
|
| 91 | 91 | |
| 92 | - $this->stub->expects( $this->once() )->method( 'getTree' ) |
|
| 93 | - ->will( $this->returnValue( $catItem ) ); |
|
| 92 | + $this->stub->expects($this->once())->method('getTree') |
|
| 93 | + ->will($this->returnValue($catItem)); |
|
| 94 | 94 | |
| 95 | - $this->assertInstanceOf( '\Aimeos\MShop\Catalog\Item\Iface', $this->object->getTree() ); |
|
| 95 | + $this->assertInstanceOf('\Aimeos\MShop\Catalog\Item\Iface', $this->object->getTree()); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | public function testGetController() |
| 100 | 100 | { |
| 101 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
| 101 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
| 102 | 102 | |
| 103 | - $this->assertSame( $this->stub, $result ); |
|
| 103 | + $this->assertSame($this->stub, $result); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
| 107 | - protected function access( $name ) |
|
| 107 | + protected function access($name) |
|
| 108 | 108 | { |
| 109 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Catalog\Decorator\Base' ); |
|
| 110 | - $method = $class->getMethod( $name ); |
|
| 111 | - $method->setAccessible( true ); |
|
| 109 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Catalog\Decorator\Base'); |
|
| 110 | + $method = $class->getMethod($name); |
|
| 111 | + $method->setAccessible(true); |
|
| 112 | 112 | |
| 113 | 113 | return $method; |
| 114 | 114 | } |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | protected function setUp() |
| 20 | 20 | { |
| 21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
| 22 | - $this->object = new \Aimeos\Controller\Frontend\Catalog\Standard( $this->context ); |
|
| 22 | + $this->object = new \Aimeos\Controller\Frontend\Catalog\Standard($this->context); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | protected function tearDown() |
| 27 | 27 | { |
| 28 | - unset( $this->object, $this->context ); |
|
| 28 | + unset($this->object, $this->context); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | $filter = $this->object->createFilter(); |
| 35 | 35 | |
| 36 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
| 36 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testGetPath() |
| 41 | 41 | { |
| 42 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' ); |
|
| 43 | - $items = $this->object->getPath( $manager->findItem( 'cafe' )->getId() ); |
|
| 42 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'catalog'); |
|
| 43 | + $items = $this->object->getPath($manager->findItem('cafe')->getId()); |
|
| 44 | 44 | |
| 45 | - $this->assertEquals( 3, count( $items ) ); |
|
| 45 | + $this->assertEquals(3, count($items)); |
|
| 46 | 46 | |
| 47 | - foreach( $items as $item ) { |
|
| 48 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Catalog\\Item\\Iface', $item ); |
|
| 47 | + foreach ($items as $item) { |
|
| 48 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Catalog\\Item\\Iface', $item); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $tree = $this->object->getTree(); |
| 56 | 56 | |
| 57 | - $this->assertEquals( 2, count( $tree->getChildren() ) ); |
|
| 57 | + $this->assertEquals(2, count($tree->getChildren())); |
|
| 58 | 58 | |
| 59 | - foreach( $tree->getChildren() as $item ) { |
|
| 60 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Catalog\\Item\\Iface', $item ); |
|
| 59 | + foreach ($tree->getChildren() as $item) { |
|
| 60 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Catalog\\Item\\Iface', $item); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys |
| 38 | 38 | * @since 2017.03 |
| 39 | 39 | */ |
| 40 | - public function getPath( $id, array $domains = array( 'text', 'media' ) ); |
|
| 40 | + public function getPath($id, array $domains = array('text', 'media')); |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -51,6 +51,6 @@ discard block |
||
| 51 | 51 | * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant |
| 52 | 52 | * @since 2017.03 |
| 53 | 53 | */ |
| 54 | - public function getTree( $id = null, array $domains = array( 'text', 'media' ), |
|
| 55 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null ); |
|
| 54 | + public function getTree($id = null, array $domains = array('text', 'media'), |
|
| 55 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null); |
|
| 56 | 56 | } |
@@ -30,18 +30,18 @@ discard block |
||
| 30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
| 31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
| 32 | 32 | */ |
| 33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
| 34 | 34 | { |
| 35 | 35 | $iface = '\Aimeos\Controller\Frontend\Catalog\Iface'; |
| 36 | - if( !( $controller instanceof $iface ) ) |
|
| 36 | + if (!($controller instanceof $iface)) |
|
| 37 | 37 | { |
| 38 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
| 39 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
| 38 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
| 39 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $this->controller = $controller; |
| 43 | 43 | |
| 44 | - parent::__construct( $context ); |
|
| 44 | + parent::__construct($context); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | * @return mixed Returns the value of the called method |
| 54 | 54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
| 55 | 55 | */ |
| 56 | - public function __call( $name, array $param ) |
|
| 56 | + public function __call($name, array $param) |
|
| 57 | 57 | { |
| 58 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
| 58 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys |
| 82 | 82 | * @since 2017.03 |
| 83 | 83 | */ |
| 84 | - public function getPath( $id, array $domains = array( 'text', 'media' ) ) |
|
| 84 | + public function getPath($id, array $domains = array('text', 'media')) |
|
| 85 | 85 | { |
| 86 | - return $this->controller->getPath( $id, $domains ); |
|
| 86 | + return $this->controller->getPath($id, $domains); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant |
| 99 | 99 | * @since 2017.03 |
| 100 | 100 | */ |
| 101 | - public function getTree( $id = null, array $domains = array( 'text', 'media' ), |
|
| 102 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null ) |
|
| 101 | + public function getTree($id = null, array $domains = array('text', 'media'), |
|
| 102 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null) |
|
| 103 | 103 | { |
| 104 | - return $this->controller->getTree( $id, $domains, $level, $search ); |
|
| 104 | + return $this->controller->getTree($id, $domains, $level, $search); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function createFilter() |
| 32 | 32 | { |
| 33 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->createSearch( true ); |
|
| 33 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->createSearch(true); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys |
| 43 | 43 | * @since 2017.03 |
| 44 | 44 | */ |
| 45 | - public function getPath( $id, array $domains = array( 'text', 'media' ) ) |
|
| 45 | + public function getPath($id, array $domains = array('text', 'media')) |
|
| 46 | 46 | { |
| 47 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getPath( $id, $domains ); |
|
| 47 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->getPath($id, $domains); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant |
| 60 | 60 | * @since 2017.03 |
| 61 | 61 | */ |
| 62 | - public function getTree( $id = null, array $domains = array( 'text', 'media' ), |
|
| 63 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null ) |
|
| 62 | + public function getTree($id = null, array $domains = array('text', 'media'), |
|
| 63 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null) |
|
| 64 | 64 | { |
| 65 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getTree( $id, $domains, $level, $search ); |
|
| 65 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->getTree($id, $domains, $level, $search); |
|
| 66 | 66 | } |
| 67 | 67 | } |