Completed
Push — master ( 17be61...1b4b4e )
by Aimeos
04:26
created
lib/custom/tests/TestHelper.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 
19 19
 		$includepaths = $aimeos->getIncludePaths();
20 20
 		$includepaths[] = get_include_path();
21
-		set_include_path( implode( PATH_SEPARATOR, $includepaths ) );
21
+		set_include_path(implode(PATH_SEPARATOR, $includepaths));
22 22
 	}
23 23
 
24 24
 
25
-	public static function getContext( $site = 'unittest' )
25
+	public static function getContext($site = 'unittest')
26 26
 	{
27
-		if( !isset( self::$context[$site] ) ) {
28
-			self::$context[$site] = self::createContext( $site );
27
+		if (!isset(self::$context[$site])) {
28
+			self::$context[$site] = self::createContext($site);
29 29
 		}
30 30
 
31 31
 		return clone self::$context[$site];
@@ -34,58 +34,58 @@  discard block
 block discarded – undo
34 34
 
35 35
 	private static function getAimeos()
36 36
 	{
37
-		if( !isset( self::$aimeos ) )
37
+		if (!isset(self::$aimeos))
38 38
 		{
39 39
 			require_once 'Bootstrap.php';
40
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
40
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
41 41
 
42
-			$extdir = dirname( dirname( dirname( __DIR__ ) ) );
43
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
42
+			$extdir = dirname(dirname(dirname(__DIR__)));
43
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
44 44
 		}
45 45
 
46 46
 		return self::$aimeos;
47 47
 	}
48 48
 
49 49
 
50
-	private static function createContext( $site )
50
+	private static function createContext($site)
51 51
 	{
52 52
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
53 53
 		$aimeos = self::getAimeos();
54 54
 
55 55
 
56
-		$paths = $aimeos->getConfigPaths( 'mysql' );
56
+		$paths = $aimeos->getConfigPaths('mysql');
57 57
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
58 58
 
59
-		$conf = new \Aimeos\MW\Config\PHPArray( [], $paths );
60
-		$ctx->setConfig( $conf );
59
+		$conf = new \Aimeos\MW\Config\PHPArray([], $paths);
60
+		$ctx->setConfig($conf);
61 61
 
62 62
 
63
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
64
-		$ctx->setDatabaseManager( $dbm );
63
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
64
+		$ctx->setDatabaseManager($dbm);
65 65
 
66 66
 
67
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
68
-		$ctx->setLogger( $logger );
67
+		$logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
68
+		$ctx->setLogger($logger);
69 69
 
70 70
 
71 71
 		$cache = new \Aimeos\MW\Cache\None();
72
-		$ctx->setCache( $cache );
72
+		$ctx->setCache($cache);
73 73
 
74 74
 
75
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
76
-		$ctx->setI18n( array( 'de' => $i18n ) );
75
+		$i18n = new \Aimeos\MW\Translation\None('de');
76
+		$ctx->setI18n(array('de' => $i18n));
77 77
 
78 78
 
79 79
 		$session = new \Aimeos\MW\Session\None();
80
-		$ctx->setSession( $session );
80
+		$ctx->setSession($session);
81 81
 
82 82
 
83
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
84
-		$localeItem = $localeManager->bootstrap( $site, '', '', false );
83
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
84
+		$localeItem = $localeManager->bootstrap($site, '', '', false);
85 85
 
86
-		$ctx->setLocale( $localeItem );
86
+		$ctx->setLocale($localeItem);
87 87
 
88
-		$ctx->setEditor( 'ai-twig:unittest' );
88
+		$ctx->setEditor('ai-twig:unittest');
89 89
 
90 90
 		return $ctx;
91 91
 	}
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Engine/TwigTest.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,56 +16,56 @@
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		if( !class_exists( '\Twig_Environment' ) ) {
20
-			$this->markTestSkipped( 'Twig_Environment is not available' );
19
+		if (!class_exists('\Twig_Environment')) {
20
+			$this->markTestSkipped('Twig_Environment is not available');
21 21
 		}
22 22
 
23
-		$this->mock = $this->getMockBuilder( '\Twig_Environment' )
24
-			->setMethods( array( 'getLoader', 'loadTemplate' ) )
23
+		$this->mock = $this->getMockBuilder('\Twig_Environment')
24
+			->setMethods(array('getLoader', 'loadTemplate'))
25 25
 			->disableOriginalConstructor()
26 26
 			->getMock();
27 27
 
28
-		$this->object = new \Aimeos\MW\View\Engine\Twig( $this->mock );
28
+		$this->object = new \Aimeos\MW\View\Engine\Twig($this->mock);
29 29
 	}
30 30
 
31 31
 
32 32
 	protected function tearDown()
33 33
 	{
34
-		unset( $this->object, $this->mock );
34
+		unset($this->object, $this->mock);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testRender()
39 39
 	{
40
-		$v = new \Aimeos\MW\View\Standard( [] );
40
+		$v = new \Aimeos\MW\View\Standard([]);
41 41
 
42
-		$view = $this->getMockBuilder( '\Twig_Template' )
43
-			->setConstructorArgs( array ( $this->mock ) )
44
-			->setMethods( array( 'getBlockNames', 'render', 'renderBlock' ) )
42
+		$view = $this->getMockBuilder('\Twig_Template')
43
+			->setConstructorArgs(array($this->mock))
44
+			->setMethods(array('getBlockNames', 'render', 'renderBlock'))
45 45
 			->getMockForAbstractClass();
46 46
 
47
-		$view->expects( $this->once() )->method( 'getBlockNames' )
48
-			->will( $this->returnValue( array( 'testblock' ) ) );
47
+		$view->expects($this->once())->method('getBlockNames')
48
+			->will($this->returnValue(array('testblock')));
49 49
 
50
-		$view->expects( $this->once() )->method( 'renderBlock' )
51
-			->will( $this->returnValue( 'block content' ) );
50
+		$view->expects($this->once())->method('renderBlock')
51
+			->will($this->returnValue('block content'));
52 52
 
53
-		$view->expects( $this->once() )->method( 'render' )
54
-			->will( $this->returnValue( 'test' ) );
53
+		$view->expects($this->once())->method('render')
54
+			->will($this->returnValue('test'));
55 55
 
56 56
 
57
-		$loader = $this->getMockBuilder( '\Twig_LoaderInterface' )
57
+		$loader = $this->getMockBuilder('\Twig_LoaderInterface')
58 58
 			->disableOriginalConstructor()
59 59
 			->getMockForAbstractClass();
60 60
 
61
-		$this->mock->expects( $this->once() )->method( 'getLoader' )
62
-			->will( $this->returnValue( $loader) );
61
+		$this->mock->expects($this->once())->method('getLoader')
62
+			->will($this->returnValue($loader));
63 63
 
64
-		$this->mock->expects( $this->once() )->method( 'loadTemplate' )
65
-			->will( $this->returnValue( $view) );
64
+		$this->mock->expects($this->once())->method('loadTemplate')
65
+			->will($this->returnValue($view));
66 66
 
67 67
 
68
-		$result = $this->object->render( $v, __FILE__, array( 'key' => 'value' ) );
69
-		$this->assertEquals( 'test', $result );
68
+		$result = $this->object->render($v, __FILE__, array('key' => 'value'));
69
+		$this->assertEquals('test', $result);
70 70
 	}
71 71
 }
Please login to merge, or discard this patch.