Completed
Push — master ( 36c1ed...275037 )
by Aimeos
01:49
created
controller/frontend/tests/Controller/Frontend/Attribute/StandardTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$this->object = new \Aimeos\Controller\Frontend\Attribute\Standard( \TestHelperFrontend::getContext() );
19
+		$this->object = new \Aimeos\Controller\Frontend\Attribute\Standard(\TestHelperFrontend::getContext());
20 20
 	}
21 21
 
22 22
 
23 23
 	protected function tearDown()
24 24
 	{
25
-		unset( $this->object );
25
+		unset($this->object);
26 26
 	}
27 27
 
28 28
 
@@ -30,57 +30,57 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$filter = $this->object->createFilter();
32 32
 
33
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
34
-		$this->assertEquals( 1, count( $filter->getSortations() ) );
35
-		$this->assertEquals( 0, $filter->getSliceStart() );
36
-		$this->assertEquals( 100, $filter->getSliceSize() );
33
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
34
+		$this->assertEquals(1, count($filter->getSortations()));
35
+		$this->assertEquals(0, $filter->getSliceStart());
36
+		$this->assertEquals(100, $filter->getSliceSize());
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testAddFilterTypes()
41 41
 	{
42 42
 		$filter = $this->object->createFilter();
43
-		$filter = $this->object->addFilterTypes( $filter, ['size'] );
43
+		$filter = $this->object->addFilterTypes($filter, ['size']);
44 44
 
45 45
 		$list = $filter->getConditions()->getExpressions();
46 46
 
47
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
48
-			throw new \RuntimeException( 'Wrong expression' );
47
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
48
+			throw new \RuntimeException('Wrong expression');
49 49
 		}
50 50
 
51
-		$this->assertEquals( 'attribute.type', $list[0]->getName() );
52
-		$this->assertEquals( 1, count( $list[0]->getValue() ) );
51
+		$this->assertEquals('attribute.type', $list[0]->getName());
52
+		$this->assertEquals(1, count($list[0]->getValue()));
53 53
 	}
54 54
 
55 55
 
56 56
 	public function testGetItem()
57 57
 	{
58 58
 		$context = \TestHelperFrontend::getContext();
59
-		$manager = \Aimeos\MShop::create( $context, 'attribute' );
60
-		$id = $manager->findItem( 'xs', [], 'product', 'size' )->getId();
59
+		$manager = \Aimeos\MShop::create($context, 'attribute');
60
+		$id = $manager->findItem('xs', [], 'product', 'size')->getId();
61 61
 
62
-		$result = $this->object->getItem( $id, ['text'] );
62
+		$result = $this->object->getItem($id, ['text']);
63 63
 
64
-		$this->assertInstanceOf( \Aimeos\MShop\Attribute\Item\Iface::class, $result );
65
-		$this->assertEquals( 3, count( $result->getRefItems( 'text' ) ) );
64
+		$this->assertInstanceOf(\Aimeos\MShop\Attribute\Item\Iface::class, $result);
65
+		$this->assertEquals(3, count($result->getRefItems('text')));
66 66
 	}
67 67
 
68 68
 
69 69
 	public function testGetItems()
70 70
 	{
71 71
 		$context = \TestHelperFrontend::getContext();
72
-		$manager = \Aimeos\MShop::create( $context, 'attribute' );
73
-		$id = $manager->findItem( 'xs', [], 'product', 'size' )->getId();
72
+		$manager = \Aimeos\MShop::create($context, 'attribute');
73
+		$id = $manager->findItem('xs', [], 'product', 'size')->getId();
74 74
 
75
-		$result = $this->object->getItems( [$id], ['text'] );
75
+		$result = $this->object->getItems([$id], ['text']);
76 76
 
77
-		$this->assertInternalType( 'array', $result );
78
-		$this->assertEquals( 1, count( $result ) );
77
+		$this->assertInternalType('array', $result);
78
+		$this->assertEquals(1, count($result));
79 79
 
80
-		foreach( $result as $attrItem )
80
+		foreach ($result as $attrItem)
81 81
 		{
82
-			$this->assertInstanceOf( \Aimeos\MShop\Attribute\Item\Iface::class, $attrItem );
83
-			$this->assertEquals( 3, count( $attrItem->getRefItems( 'text' ) ) );
82
+			$this->assertInstanceOf(\Aimeos\MShop\Attribute\Item\Iface::class, $attrItem);
83
+			$this->assertEquals(3, count($attrItem->getRefItems('text')));
84 84
 		}
85 85
 	}
86 86
 
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 	public function testSearchItems()
89 89
 	{
90 90
 		$filter = $this->object->createFilter();
91
-		$filter = $this->object->addFilterTypes( $filter, ['size'] );
91
+		$filter = $this->object->addFilterTypes($filter, ['size']);
92 92
 
93 93
 		$total = 0;
94
-		$results = $this->object->searchItems( $filter, ['text'], $total );
94
+		$results = $this->object->searchItems($filter, ['text'], $total);
95 95
 
96
-		$this->assertEquals( 6, $total );
97
-		$this->assertEquals( 6, count( $results ) );
96
+		$this->assertEquals(6, $total);
97
+		$this->assertEquals(6, count($results));
98 98
 	}
99 99
 }
Please login to merge, or discard this patch.
controller/frontend/tests/TestHelperFrontend.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 	public static function bootstrap()
16 16
 	{
17 17
 		self::getAimeos();
18
-		\Aimeos\MShop::cache( false );
19
-		\Aimeos\Controller\Frontend\Factory::setCache( false );
18
+		\Aimeos\MShop::cache(false);
19
+		\Aimeos\Controller\Frontend\Factory::setCache(false);
20 20
 	}
21 21
 
22 22
 
23
-	public static function getContext( $site = 'unittest' )
23
+	public static function getContext($site = 'unittest')
24 24
 	{
25
-		if( !isset( self::$context[$site] ) ) {
26
-			self::$context[$site] = self::createContext( $site );
25
+		if (!isset(self::$context[$site])) {
26
+			self::$context[$site] = self::createContext($site);
27 27
 		}
28 28
 
29 29
 		return clone self::$context[$site];
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 
33 33
 	private static function getAimeos()
34 34
 	{
35
-		if( !isset( self::$aimeos ) )
35
+		if (!isset(self::$aimeos))
36 36
 		{
37 37
 			require_once 'Bootstrap.php';
38
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
38
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
39 39
 
40
-			$extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) );
41
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true );
40
+			$extdir = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
41
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true);
42 42
 		}
43 43
 
44 44
 		return self::$aimeos;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * @param string $site
50 50
 	 */
51
-	private static function createContext( $site )
51
+	private static function createContext($site)
52 52
 	{
53 53
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
54 54
 		$aimeos = self::getAimeos();
@@ -58,38 +58,38 @@  discard block
 block discarded – undo
58 58
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
59 59
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
60 60
 
61
-		$conf = new \Aimeos\MW\Config\PHPArray( [], $paths );
62
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
63
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
64
-		$ctx->setConfig( $conf );
61
+		$conf = new \Aimeos\MW\Config\PHPArray([], $paths);
62
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
63
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
64
+		$ctx->setConfig($conf);
65 65
 
66 66
 
67
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
68
-		$ctx->setDatabaseManager( $dbm );
67
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
68
+		$ctx->setDatabaseManager($dbm);
69 69
 
70 70
 
71
-		$mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf );
72
-		$ctx->setMessageQueueManager( $mq );
71
+		$mq = new \Aimeos\MW\MQueue\Manager\Standard($conf);
72
+		$ctx->setMessageQueueManager($mq);
73 73
 
74 74
 
75
-		$logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG );
76
-		$ctx->setLogger( $logger );
75
+		$logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG);
76
+		$ctx->setLogger($logger);
77 77
 
78 78
 
79
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
80
-		$ctx->setI18n( array( 'de' => $i18n ) );
79
+		$i18n = new \Aimeos\MW\Translation\None('de');
80
+		$ctx->setI18n(array('de' => $i18n));
81 81
 
82 82
 
83 83
 		$session = new \Aimeos\MW\Session\None();
84
-		$ctx->setSession( $session );
84
+		$ctx->setSession($session);
85 85
 
86 86
 
87
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx );
88
-		$locale = $localeManager->bootstrap( $site, '', '', false );
89
-		$ctx->setLocale( $locale );
87
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::create($ctx);
88
+		$locale = $localeManager->bootstrap($site, '', '', false);
89
+		$ctx->setLocale($locale);
90 90
 
91 91
 
92
-		$ctx->setEditor( 'core:controller/frontend' );
92
+		$ctx->setEditor('core:controller/frontend');
93 93
 
94 94
 		return $ctx;
95 95
 	}
Please login to merge, or discard this patch.