Completed
Push — master ( fa87fb...106664 )
by Aimeos
05:31
created
admin/jsonadm/tests/Admin/JsonAdm/Price/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Media\Standard( $this->context, $this->view, $templatePaths, 'price' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Media\Standard($this->context, $this->view, $templatePaths, 'price');
26 26
 	}
27 27
 
28 28
 
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'price.value' => '12.95' )
33
+				'==' => array('price.value' => '12.95')
34 34
 			),
35 35
 			'include' => 'attribute'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 2, $result['meta']['total'] );
48
-		$this->assertEquals( 2, count( $result['data'] ) );
49
-		$this->assertEquals( 'price', $result['data'][0]['type'] );
50
-		$this->assertEquals( 0, count( $result['data'][0]['relationships'] ) );
51
-		$this->assertEquals( 0, count( $result['included'] ) );
47
+		$this->assertEquals(2, $result['meta']['total']);
48
+		$this->assertEquals(2, count($result['data']));
49
+		$this->assertEquals('price', $result['data'][0]['type']);
50
+		$this->assertEquals(0, count($result['data'][0]['relationships']));
51
+		$this->assertEquals(0, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/TestHelperJadm.php 1 patch
Spacing   +48 added lines, -48 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\Factory::setCache( false );
19
-		\Aimeos\Admin\JsonAdm\Factory::setCache( false );
18
+		\Aimeos\MShop\Factory::setCache(false);
19
+		\Aimeos\Admin\JsonAdm\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
 	public 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( __FILE__ ) ) ) );
41
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
40
+			$extdir = dirname(dirname(dirname(dirname(__FILE__))));
41
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
42 42
 		}
43 43
 
44 44
 		return self::$aimeos;
@@ -47,85 +47,85 @@  discard block
 block discarded – undo
47 47
 
48 48
 	public static function getJsonadmPaths()
49 49
 	{
50
-		return self::getAimeos()->getCustomPaths( 'admin/jsonadm/templates' );
50
+		return self::getAimeos()->getCustomPaths('admin/jsonadm/templates');
51 51
 	}
52 52
 
53 53
 
54
-	private static function createContext( $site )
54
+	private static function createContext($site)
55 55
 	{
56 56
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
57 57
 		$aimeos = self::getAimeos();
58 58
 
59 59
 
60
-		$paths = $aimeos->getConfigPaths( 'mysql' );
60
+		$paths = $aimeos->getConfigPaths('mysql');
61 61
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
62 62
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
63 63
 
64
-		$conf = new \Aimeos\MW\Config\PHPArray( array(), $paths );
65
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
66
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
67
-		$ctx->setConfig( $conf );
64
+		$conf = new \Aimeos\MW\Config\PHPArray(array(), $paths);
65
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
66
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
67
+		$ctx->setConfig($conf);
68 68
 
69 69
 
70
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
71
-		$ctx->setDatabaseManager( $dbm );
70
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
71
+		$ctx->setDatabaseManager($dbm);
72 72
 
73 73
 
74
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
75
-		$ctx->setLogger( $logger );
74
+		$logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
75
+		$ctx->setLogger($logger);
76 76
 
77 77
 
78 78
 		$session = new \Aimeos\MW\Session\None();
79
-		$ctx->setSession( $session );
79
+		$ctx->setSession($session);
80 80
 
81 81
 
82
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
83
-		$ctx->setI18n( array( 'de' => $i18n ) );
82
+		$i18n = new \Aimeos\MW\Translation\None('de');
83
+		$ctx->setI18n(array('de' => $i18n));
84 84
 
85 85
 
86
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
87
-		$locale = $localeManager->bootstrap( $site, 'de', '', false );
88
-		$ctx->setLocale( $locale );
86
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
87
+		$locale = $localeManager->bootstrap($site, 'de', '', false);
88
+		$ctx->setLocale($locale);
89 89
 
90 90
 
91
-		$view = self::createView( $conf );
92
-		$ctx->setView( $view );
91
+		$view = self::createView($conf);
92
+		$ctx->setView($view);
93 93
 
94 94
 
95
-		$ctx->setEditor( 'core:admin/jsonadm' );
95
+		$ctx->setEditor('core:admin/jsonadm');
96 96
 
97 97
 		return $ctx;
98 98
 	}
99 99
 
100 100
 
101
-	protected static function createView( \Aimeos\MW\Config\Iface $config )
101
+	protected static function createView(\Aimeos\MW\Config\Iface $config)
102 102
 	{
103
-		$tmplpaths = self::getAimeos()->getCustomPaths( 'admin/jsonadm/templates' );
103
+		$tmplpaths = self::getAimeos()->getCustomPaths('admin/jsonadm/templates');
104 104
 
105
-		$view = new \Aimeos\MW\View\Standard( $tmplpaths );
105
+		$view = new \Aimeos\MW\View\Standard($tmplpaths);
106 106
 
107
-		$trans = new \Aimeos\MW\Translation\None( 'de_DE' );
108
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans );
109
-		$view->addHelper( 'translate', $helper );
107
+		$trans = new \Aimeos\MW\Translation\None('de_DE');
108
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans);
109
+		$view->addHelper('translate', $helper);
110 110
 
111
-		$helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' );
112
-		$view->addHelper( 'url', $helper );
111
+		$helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl');
112
+		$view->addHelper('url', $helper);
113 113
 
114
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' );
115
-		$view->addHelper( 'number', $helper );
114
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', '');
115
+		$view->addHelper('number', $helper);
116 116
 
117
-		$helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' );
118
-		$view->addHelper( 'date', $helper );
117
+		$helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d');
118
+		$view->addHelper('date', $helper);
119 119
 
120
-		$config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'admin/jsonadm' ) );
121
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
122
-		$view->addHelper( 'config', $helper );
120
+		$config = new \Aimeos\MW\Config\Decorator\Protect($config, array('admin/jsonadm'));
121
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
122
+		$view->addHelper('config', $helper);
123 123
 
124
-		$helper = new \Aimeos\MW\View\Helper\Request\Standard( $view, new \Zend\Diactoros\ServerRequest() );
125
-		$view->addHelper( 'request', $helper );
124
+		$helper = new \Aimeos\MW\View\Helper\Request\Standard($view, new \Zend\Diactoros\ServerRequest());
125
+		$view->addHelper('request', $helper);
126 126
 
127
-		$helper = new \Aimeos\MW\View\Helper\Response\Standard( $view, new \Zend\Diactoros\Response() );
128
-		$view->addHelper( 'response', $helper );
127
+		$helper = new \Aimeos\MW\View\Helper\Response\Standard($view, new \Zend\Diactoros\Response());
128
+		$view->addHelper('response', $helper);
129 129
 
130 130
 		return $view;
131 131
 	}
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Order/Base/Standard.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
111 111
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
112 112
 	 */
113
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
113
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
114 114
 	{
115 115
 		/** admin/jsonadm/partials/order/base/template-data
116 116
 		 * Relative path to the data partial template file for the order base client
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 		 * @since 2016.01
128 128
 		 * @category Developer
129 129
 		 */
130
-		$this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/base/template-data' ) );
130
+		$this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/base/template-data'));
131 131
 
132
-		return parent::get( $request, $response );
132
+		return parent::get($request, $response);
133 133
 	}
134 134
 
135 135
 
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 	 * @param array $include List of resource types that should be fetched
141 141
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
142 142
 	 */
143
-	protected function getChildItems( array $items, array $include )
143
+	protected function getChildItems(array $items, array $include)
144 144
 	{
145 145
 		$list = array();
146
-		$ids = array_keys( $items );
147
-		$keys = array( 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service' );
148
-		$include = array_intersect( $include, $keys );
146
+		$ids = array_keys($items);
147
+		$keys = array('order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service');
148
+		$include = array_intersect($include, $keys);
149 149
 
150
-		foreach( $include as $type )
150
+		foreach ($include as $type)
151 151
 		{
152
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type );
152
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type);
153 153
 
154 154
 			$search = $manager->createSearch();
155
-			$search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.baseid', $ids ) );
155
+			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.baseid', $ids));
156 156
 
157
-			$list = array_merge( $list, $manager->searchItems( $search ) );
157
+			$list = array_merge($list, $manager->searchItems($search));
158 158
 		}
159 159
 
160 160
 		return $list;
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Common/Decorator/Base.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	 * @param array $templatePaths List of file system paths where the templates are stored
37 37
 	 * @param string $path Name of the client separated by slashes, e.g "product/property"
38 38
 	 */
39
-	public function __construct( \Aimeos\Admin\JsonAdm\Iface $client,
40
-		\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path )
39
+	public function __construct(\Aimeos\Admin\JsonAdm\Iface $client,
40
+		\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path)
41 41
 	{
42
-		parent::__construct( $context, $view, $templatePaths, $path );
42
+		parent::__construct($context, $view, $templatePaths, $path);
43 43
 
44 44
 		$this->client = $client;
45 45
 	}
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 * @return mixed Returns the value of the called method
54 54
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If method call failed
55 55
 	 */
56
-	public function __call( $name, array $param )
56
+	public function __call($name, array $param)
57 57
 	{
58
-		if( ( $result = call_user_func_array( array( $this->client, $name ), $param ) ) === false ) {
59
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Unable to call method "%1$s"', $name ) );
58
+		if (($result = call_user_func_array(array($this->client, $name), $param)) === false) {
59
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Unable to call method "%1$s"', $name));
60 60
 		}
61 61
 
62 62
 		return $result;
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
71 71
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
72 72
 	 */
73
-	public function delete( ServerRequestInterface $request, ResponseInterface $response )
73
+	public function delete(ServerRequestInterface $request, ResponseInterface $response)
74 74
 	{
75
-		return $this->client->delete( $request, $response );
75
+		return $this->client->delete($request, $response);
76 76
 	}
77 77
 
78 78
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
84 84
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
85 85
 	 */
86
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
86
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
87 87
 	{
88
-		return $this->client->get( $request, $response );
88
+		return $this->client->get($request, $response);
89 89
 	}
90 90
 
91 91
 
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
98 98
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
99 99
 	 */
100
-	public function patch( ServerRequestInterface $request, ResponseInterface $response )
100
+	public function patch(ServerRequestInterface $request, ResponseInterface $response)
101 101
 	{
102
-		return $this->client->patch( $request, $response );
102
+		return $this->client->patch($request, $response);
103 103
 	}
104 104
 
105 105
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
112 112
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
113 113
 	 */
114
-	public function post( ServerRequestInterface $request, ResponseInterface $response )
114
+	public function post(ServerRequestInterface $request, ResponseInterface $response)
115 115
 	{
116
-		return $this->client->post( $request, $response );
116
+		return $this->client->post($request, $response);
117 117
 	}
118 118
 
119 119
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
126 126
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
127 127
 	 */
128
-	public function put( ServerRequestInterface $request, ResponseInterface $response )
128
+	public function put(ServerRequestInterface $request, ResponseInterface $response)
129 129
 	{
130
-		return $this->client->put( $request, $response );
130
+		return $this->client->put($request, $response);
131 131
 	}
132 132
 
133 133
 
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
140 140
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
141 141
 	 */
142
-	public function options( ServerRequestInterface $request, ResponseInterface $response )
142
+	public function options(ServerRequestInterface $request, ResponseInterface $response)
143 143
 	{
144
-		return $this->client->options( $request, $response );
144
+		return $this->client->options($request, $response);
145 145
 	}
146 146
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Iface.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
30 30
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
31 31
 	 */
32
-	public function delete( ServerRequestInterface $request, ResponseInterface $response );
32
+	public function delete(ServerRequestInterface $request, ResponseInterface $response);
33 33
 
34 34
 
35 35
 	/**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
40 40
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
41 41
 	 */
42
-	public function get( ServerRequestInterface $request, ResponseInterface $response );
42
+	public function get(ServerRequestInterface $request, ResponseInterface $response);
43 43
 
44 44
 
45 45
 	/**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
50 50
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
51 51
 	 */
52
-	public function patch( ServerRequestInterface $request, ResponseInterface $response );
52
+	public function patch(ServerRequestInterface $request, ResponseInterface $response);
53 53
 
54 54
 
55 55
 	/**
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
60 60
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
61 61
 	 */
62
-	public function post( ServerRequestInterface $request, ResponseInterface $response );
62
+	public function post(ServerRequestInterface $request, ResponseInterface $response);
63 63
 
64 64
 
65 65
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
70 70
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
71 71
 	 */
72
-	public function put( ServerRequestInterface $request, ResponseInterface $response );
72
+	public function put(ServerRequestInterface $request, ResponseInterface $response);
73 73
 
74 74
 
75 75
 	/**
@@ -79,5 +79,5 @@  discard block
 block discarded – undo
79 79
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
80 80
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
81 81
 	 */
82
-	public function options( ServerRequestInterface $request, ResponseInterface $response );
82
+	public function options(ServerRequestInterface $request, ResponseInterface $response);
83 83
 }
Please login to merge, or discard this patch.