@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | protected function setUp() |
27 | 27 | { |
28 | - if( class_exists( '\\TYPO3\\Flow\\Session\\Session' ) === false ) { |
|
29 | - $this->markTestSkipped( 'Class \\TYPO3\\Flow\\Session\\Session not found' ); |
|
28 | + if (class_exists('\\TYPO3\\Flow\\Session\\Session') === false) { |
|
29 | + $this->markTestSkipped('Class \\TYPO3\\Flow\\Session\\Session not found'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $session = new \TYPO3\Flow\Session\TransientSession(); |
33 | 33 | $session->start(); |
34 | 34 | |
35 | - $this->object = new \Aimeos\MW\Session\Flow( $session ); |
|
35 | + $this->object = new \Aimeos\MW\Session\Flow($session); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -44,26 +44,26 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function tearDown() |
46 | 46 | { |
47 | - unset( $this->object ); |
|
47 | + unset($this->object); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testGetDefault() |
52 | 52 | { |
53 | - $this->assertEquals( null, $this->object->get( 'notexist' ) ); |
|
53 | + $this->assertEquals(null, $this->object->get('notexist')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | public function testGetSet() |
58 | 58 | { |
59 | - $this->object->set( 'key', 'value' ); |
|
60 | - $this->assertEquals( 'value', $this->object->get( 'key' ) ); |
|
59 | + $this->object->set('key', 'value'); |
|
60 | + $this->assertEquals('value', $this->object->get('key')); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | public function testGetSetArray() |
65 | 65 | { |
66 | - $this->object->set( 'key', array( 'value' ) ); |
|
67 | - $this->assertEquals( array( 'value' ), $this->object->get( 'key' ) ); |
|
66 | + $this->object->set('key', array('value')); |
|
67 | + $this->assertEquals(array('value'), $this->object->get('key')); |
|
68 | 68 | } |
69 | 69 | } |
@@ -9,17 +9,17 @@ |
||
9 | 9 | * Set error reporting to maximum |
10 | 10 | */ |
11 | 11 | error_reporting( -1 ); |
12 | -ini_set( 'display_errors', '1' ); |
|
12 | +ini_set('display_errors', '1'); |
|
13 | 13 | |
14 | 14 | |
15 | 15 | /* |
16 | 16 | * Set locale settings to reasonable defaults |
17 | 17 | */ |
18 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
19 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
20 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
21 | -setlocale( LC_TIME, 'POSIX' ); |
|
22 | -date_default_timezone_set( 'UTC' ); |
|
18 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
19 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
20 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
21 | +setlocale(LC_TIME, 'POSIX'); |
|
22 | +date_default_timezone_set('UTC'); |
|
23 | 23 | |
24 | 24 | require_once 'TestHelper.php'; |
25 | 25 | TestHelper::bootstrap(); |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | |
18 | 18 | $includepaths = $mshop->getIncludePaths(); |
19 | 19 | $includepaths[] = get_include_path(); |
20 | - set_include_path( implode( PATH_SEPARATOR, $includepaths ) ); |
|
20 | + set_include_path(implode(PATH_SEPARATOR, $includepaths)); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | - public static function getContext( $site = 'unittest' ) |
|
24 | + public static function getContext($site = 'unittest') |
|
25 | 25 | { |
26 | - if( !isset( self::$context[$site] ) ) { |
|
27 | - self::$context[$site] = self::createContext( $site ); |
|
26 | + if (!isset(self::$context[$site])) { |
|
27 | + self::$context[$site] = self::createContext($site); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | return clone self::$context[$site]; |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | |
34 | 34 | private static function getAimeos() |
35 | 35 | { |
36 | - if( !isset( self::$aimeos ) ) |
|
36 | + if (!isset(self::$aimeos)) |
|
37 | 37 | { |
38 | 38 | require_once 'Bootstrap.php'; |
39 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
39 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
40 | 40 | |
41 | - $extdir = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
|
42 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false ); |
|
41 | + $extdir = dirname(dirname(dirname(dirname(__FILE__)))); |
|
42 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | return self::$aimeos; |
@@ -52,37 +52,37 @@ discard block |
||
52 | 52 | * @param string $site Unique site code |
53 | 53 | * @return \\Aimeos\MShop\Context\Item\Iface Context object |
54 | 54 | */ |
55 | - private static function createContext( $site ) |
|
55 | + private static function createContext($site) |
|
56 | 56 | { |
57 | 57 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
58 | 58 | $mshop = self::getAimeos(); |
59 | 59 | |
60 | 60 | |
61 | - $paths = $mshop->getConfigPaths( 'mysql' ); |
|
61 | + $paths = $mshop->getConfigPaths('mysql'); |
|
62 | 62 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
63 | 63 | |
64 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
65 | - $ctx->setConfig( $conf ); |
|
64 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
65 | + $ctx->setConfig($conf); |
|
66 | 66 | |
67 | 67 | |
68 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
69 | - $ctx->setDatabaseManager( $dbm ); |
|
68 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
69 | + $ctx->setDatabaseManager($dbm); |
|
70 | 70 | |
71 | 71 | |
72 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
73 | - $ctx->setLogger( $logger ); |
|
72 | + $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
73 | + $ctx->setLogger($logger); |
|
74 | 74 | |
75 | 75 | |
76 | 76 | $session = new \Aimeos\MW\Session\None(); |
77 | - $ctx->setSession( $session ); |
|
77 | + $ctx->setSession($session); |
|
78 | 78 | |
79 | 79 | |
80 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
81 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
80 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
81 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
82 | 82 | |
83 | - $ctx->setLocale( $localeItem ); |
|
83 | + $ctx->setLocale($localeItem); |
|
84 | 84 | |
85 | - $ctx->setEditor( 'ai-flow:unittest' ); |
|
85 | + $ctx->setEditor('ai-flow:unittest'); |
|
86 | 86 | |
87 | 87 | return $ctx; |
88 | 88 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param \TYPO3\Flow\Log\SystemLoggerInterface $logger Flow logger object |
31 | 31 | */ |
32 | - public function __construct( \TYPO3\Flow\Log\SystemLoggerInterface $logger ) |
|
32 | + public function __construct(\TYPO3\Flow\Log\SystemLoggerInterface $logger) |
|
33 | 33 | { |
34 | 34 | $this->logger = $logger; |
35 | 35 | } |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | * @throws \Aimeos\MW\Logger\Exception If an error occurs in Zend_Log |
45 | 45 | * @see \Aimeos\MW\Logger\Base for available log level constants |
46 | 46 | */ |
47 | - public function log( $message, $priority = \Aimeos\MW\Logger\Base::ERR, $facility = 'message' ) |
|
47 | + public function log($message, $priority = \Aimeos\MW\Logger\Base::ERR, $facility = 'message') |
|
48 | 48 | { |
49 | 49 | try |
50 | 50 | { |
51 | - if( !is_scalar( $message ) ) { |
|
52 | - $message = json_encode( $message ); |
|
51 | + if (!is_scalar($message)) { |
|
52 | + $message = json_encode($message); |
|
53 | 53 | } |
54 | 54 | |
55 | - $this->logger->log( $message, $this->translatePriority( $priority ) ); |
|
55 | + $this->logger->log($message, $this->translatePriority($priority)); |
|
56 | 56 | } |
57 | - catch( \Exception $e ) { |
|
58 | - throw new \Aimeos\MW\Logger\Exception( $e->getMessage(), $e->getCode(), $e ); |
|
57 | + catch (\Exception $e) { |
|
58 | + throw new \Aimeos\MW\Logger\Exception($e->getMessage(), $e->getCode(), $e); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @return integer Log level from Monolog\Logger |
68 | 68 | * @throws \Aimeos\MW\Logger\Exception If log level is unknown |
69 | 69 | */ |
70 | - protected function translatePriority( $priority ) |
|
70 | + protected function translatePriority($priority) |
|
71 | 71 | { |
72 | - switch( $priority ) |
|
72 | + switch ($priority) |
|
73 | 73 | { |
74 | 74 | case \Aimeos\MW\Logger\Base::EMERG: |
75 | 75 | return LOG_EMERG; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | case \Aimeos\MW\Logger\Base::DEBUG: |
89 | 89 | return LOG_DEBUG; |
90 | 90 | default: |
91 | - throw new \Aimeos\MW\Logger\Exception( 'Invalid log level' ); |
|
91 | + throw new \Aimeos\MW\Logger\Exception('Invalid log level'); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
95 | 95 | \ No newline at end of file |
@@ -53,8 +53,7 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | $this->logger->log( $message, $this->translatePriority( $priority ) ); |
56 | - } |
|
57 | - catch( \Exception $e ) { |
|
56 | + } catch( \Exception $e ) { |
|
58 | 57 | throw new \Aimeos\MW\Logger\Exception( $e->getMessage(), $e->getCode(), $e ); |
59 | 58 | } |
60 | 59 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param \TYPO3\Flow\Session\SessionInterface $object Flow session object |
30 | 30 | */ |
31 | - public function __construct( \TYPO3\Flow\Session\SessionInterface $object ) |
|
31 | + public function __construct(\TYPO3\Flow\Session\SessionInterface $object) |
|
32 | 32 | { |
33 | 33 | $this->object = $object; |
34 | 34 | } |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | * @param mixed $default Value returned if requested key isn't found |
44 | 44 | * @return mixed Value associated to the requested key |
45 | 45 | */ |
46 | - public function get( $name, $default = null ) |
|
46 | + public function get($name, $default = null) |
|
47 | 47 | { |
48 | - if( $this->object->hasKey( $name ) !== true ) { |
|
48 | + if ($this->object->hasKey($name) !== true) { |
|
49 | 49 | return $default; |
50 | 50 | } |
51 | 51 | |
52 | - return $this->object->getData( $name ); |
|
52 | + return $this->object->getData($name); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param mixed $value Value that should be associated with the given key |
63 | 63 | * @return void |
64 | 64 | */ |
65 | - public function set( $name, $value ) |
|
65 | + public function set($name, $value) |
|
66 | 66 | { |
67 | - $this->object->putData( $name, $value ); |
|
67 | + $this->object->putData($name, $value); |
|
68 | 68 | } |
69 | 69 | } |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param array $config List of configuration values |
32 | 32 | * @param \TYPO3\Flow\Cache\Frontend\FrontendInterface $cache TYPO3 cache object |
33 | 33 | */ |
34 | - public function __construct( array $config, \TYPO3\Flow\Cache\Frontend\FrontendInterface $cache ) |
|
34 | + public function __construct(array $config, \TYPO3\Flow\Cache\Frontend\FrontendInterface $cache) |
|
35 | 35 | { |
36 | - $this->prefix = ( isset( $config['siteid'] ) ? $config['siteid'] . '-' : '' ); |
|
36 | + $this->prefix = (isset($config['siteid']) ? $config['siteid'] . '-' : ''); |
|
37 | 37 | $this->object = $cache; |
38 | 38 | } |
39 | 39 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @param string $key Key string that identifies the single cache entry |
47 | 47 | */ |
48 | - public function delete( $key ) |
|
48 | + public function delete($key) |
|
49 | 49 | { |
50 | - $this->object->remove( $this->prefix . $key ); |
|
50 | + $this->object->remove($this->prefix . $key); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * @param string[] $keys List of key strings that identify the cache entries |
60 | 60 | * that should be removed |
61 | 61 | */ |
62 | - public function deleteList( array $keys ) |
|
62 | + public function deleteList(array $keys) |
|
63 | 63 | { |
64 | - foreach( $keys as $key ) { |
|
65 | - $this->object->remove( $this->prefix . $key ); |
|
64 | + foreach ($keys as $key) { |
|
65 | + $this->object->remove($this->prefix . $key); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | * @param string[] $tags List of tag strings that are associated to one or more |
76 | 76 | * cache entries that should be removed |
77 | 77 | */ |
78 | - public function deleteByTags( array $tags ) |
|
78 | + public function deleteByTags(array $tags) |
|
79 | 79 | { |
80 | - foreach( $tags as $tag ) { |
|
81 | - $this->object->flushByTag( $this->prefix . $tag ); |
|
80 | + foreach ($tags as $tag) { |
|
81 | + $this->object->flushByTag($this->prefix . $tag); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function flush() |
92 | 92 | { |
93 | - if( $this->prefix ) { |
|
94 | - $this->object->flushByTag( $this->prefix . 'siteid' ); |
|
93 | + if ($this->prefix) { |
|
94 | + $this->object->flushByTag($this->prefix . 'siteid'); |
|
95 | 95 | } else { |
96 | 96 | $this->object->flush(); |
97 | 97 | } |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | * @param string $default Value returned if requested key isn't found |
108 | 108 | * @return mixed Value associated to the requested key |
109 | 109 | */ |
110 | - public function get( $name, $default = null ) |
|
110 | + public function get($name, $default = null) |
|
111 | 111 | { |
112 | - if( ( $entry = $this->object->get( $this->prefix . $name ) ) !== false ) { |
|
112 | + if (($entry = $this->object->get($this->prefix . $name)) !== false) { |
|
113 | 113 | return $entry; |
114 | 114 | } |
115 | 115 | |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | * entries. If a cache entry doesn't exist, neither its key nor a value |
128 | 128 | * will be in the result list |
129 | 129 | */ |
130 | - public function getList( array $keys ) |
|
130 | + public function getList(array $keys) |
|
131 | 131 | { |
132 | 132 | $result = array(); |
133 | 133 | |
134 | - foreach( $keys as $key ) |
|
134 | + foreach ($keys as $key) |
|
135 | 135 | { |
136 | - if( ( $entry = $this->object->get( $this->prefix . $key ) ) !== false ) { |
|
136 | + if (($entry = $this->object->get($this->prefix . $key)) !== false) { |
|
137 | 137 | $result[$key] = $entry; |
138 | 138 | } |
139 | 139 | } |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | * entries. If a tag isn't associated to any cache entry, nothing is returned |
153 | 153 | * for that tag |
154 | 154 | */ |
155 | - public function getListByTags( array $tags ) |
|
155 | + public function getListByTags(array $tags) |
|
156 | 156 | { |
157 | 157 | $result = array(); |
158 | - $len = strlen( $this->prefix ); |
|
158 | + $len = strlen($this->prefix); |
|
159 | 159 | |
160 | - foreach( $tags as $tag ) |
|
160 | + foreach ($tags as $tag) |
|
161 | 161 | { |
162 | - foreach( $this->object->getByTag( $this->prefix . $tag ) as $key => $value ) |
|
162 | + foreach ($this->object->getByTag($this->prefix . $tag) as $key => $value) |
|
163 | 163 | { |
164 | - if( strncmp( $key, $this->prefix, $len ) === 0 ) { |
|
165 | - $result[ substr( $key, $len ) ] = $value; |
|
164 | + if (strncmp($key, $this->prefix, $len) === 0) { |
|
165 | + $result[substr($key, $len)] = $value; |
|
166 | 166 | } else { |
167 | 167 | $result[$key] = $value; |
168 | 168 | } |
@@ -186,21 +186,21 @@ discard block |
||
186 | 186 | * @param string|null $expires Date/time string in "YYYY-MM-DD HH:mm:ss" |
187 | 187 | * format when the cache entry expires |
188 | 188 | */ |
189 | - public function set( $name, $value, array $tags = array(), $expires = null ) |
|
189 | + public function set($name, $value, array $tags = array(), $expires = null) |
|
190 | 190 | { |
191 | - if( $expires !== null && ( $timestamp = strtotime( $expires ) ) !== false ) { |
|
191 | + if ($expires !== null && ($timestamp = strtotime($expires)) !== false) { |
|
192 | 192 | $expires = $timestamp; |
193 | 193 | } else { |
194 | 194 | $expires = null; |
195 | 195 | } |
196 | 196 | |
197 | - $tagList = ( $this->prefix ? array( $this->prefix . 'siteid' ) : array() ); |
|
197 | + $tagList = ($this->prefix ? array($this->prefix . 'siteid') : array()); |
|
198 | 198 | |
199 | - foreach( $tags as $tag ) { |
|
199 | + foreach ($tags as $tag) { |
|
200 | 200 | $tagList[] = $this->prefix . $tag; |
201 | 201 | } |
202 | 202 | |
203 | - $this->object->set( $this->prefix . $name, $value, $tagList, $expires ); |
|
203 | + $this->object->set($this->prefix . $name, $value, $tagList, $expires); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | * to the key can either be a tag string or an array of tag strings |
218 | 218 | * @param array $expires Associative list of key/datetime pairs. |
219 | 219 | */ |
220 | - public function setList( array $pairs, array $tags = array(), array $expires = array() ) |
|
220 | + public function setList(array $pairs, array $tags = array(), array $expires = array()) |
|
221 | 221 | { |
222 | - foreach( $pairs as $key => $value ) |
|
222 | + foreach ($pairs as $key => $value) |
|
223 | 223 | { |
224 | - $tagList = ( isset( $tags[$key] ) ? (array) $tags[$key] : array() ); |
|
225 | - $keyExpire = ( isset( $expires[$key] ) ? $expires[$key] : null ); |
|
224 | + $tagList = (isset($tags[$key]) ? (array) $tags[$key] : array()); |
|
225 | + $keyExpire = (isset($expires[$key]) ? $expires[$key] : null); |
|
226 | 226 | |
227 | - $this->set( $key, $value, $tagList, $keyExpire ); |
|
227 | + $this->set($key, $value, $tagList, $keyExpire); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param \TYPO3\Flow\Mvc\Routing\UriBuilder $builder Flow URI builder object |
32 | 32 | * @param array Associative list of fixed parameters that should be available for all routes |
33 | 33 | */ |
34 | - public function __construct( $view, \TYPO3\Flow\Mvc\Routing\UriBuilder $builder, array $fixed ) |
|
34 | + public function __construct($view, \TYPO3\Flow\Mvc\Routing\UriBuilder $builder, array $fixed) |
|
35 | 35 | { |
36 | - parent::__construct( $view ); |
|
36 | + parent::__construct($view); |
|
37 | 37 | |
38 | 38 | $this->builder = $builder; |
39 | 39 | $this->fixed = $fixed; |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | * @param array $config Additional configuration parameter per URL |
52 | 52 | * @return string Complete URL that can be used in the template |
53 | 53 | */ |
54 | - public function transform( $target = null, $controller = null, $action = null, array $params = array(), array $trailing = array(), array $config = array() ) |
|
54 | + public function transform($target = null, $controller = null, $action = null, array $params = array(), array $trailing = array(), array $config = array()) |
|
55 | 55 | { |
56 | - $values = $this->getValues( $config ); |
|
56 | + $values = $this->getValues($config); |
|
57 | 57 | |
58 | 58 | $this->builder |
59 | 59 | ->reset() |
60 | - ->setSection( join( '/', $trailing ) ) |
|
61 | - ->setCreateAbsoluteUri( $values['absoluteUri'] ) |
|
62 | - ->setFormat( $values['format'] ); |
|
60 | + ->setSection(join('/', $trailing)) |
|
61 | + ->setCreateAbsoluteUri($values['absoluteUri']) |
|
62 | + ->setFormat($values['format']); |
|
63 | 63 | |
64 | 64 | $params['node'] = $target; |
65 | 65 | |
66 | - return $this->builder->uriFor( $action, $params + $this->fixed, $controller, $values['package'], $values['subpackage'] ); |
|
66 | + return $this->builder->uriFor($action, $params + $this->fixed, $controller, $values['package'], $values['subpackage']); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param array $config Associative list of key/value pairs |
74 | 74 | * @return array Associative list of sanitized key/value pairs |
75 | 75 | */ |
76 | - protected function getValues( array $config ) |
|
76 | + protected function getValues(array $config) |
|
77 | 77 | { |
78 | 78 | $values = array( |
79 | 79 | 'package' => null, |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | 'format' => 'html', |
83 | 83 | ); |
84 | 84 | |
85 | - if( isset( $config['package'] ) ) { |
|
85 | + if (isset($config['package'])) { |
|
86 | 86 | $values['package'] = (string) $config['package']; |
87 | 87 | } |
88 | 88 | |
89 | - if( isset( $config['subpackage'] ) ) { |
|
89 | + if (isset($config['subpackage'])) { |
|
90 | 90 | $values['subpackage'] = (string) $config['subpackage']; |
91 | 91 | } |
92 | 92 | |
93 | - if( isset( $config['absoluteUri'] ) ) { |
|
93 | + if (isset($config['absoluteUri'])) { |
|
94 | 94 | $values['absoluteUri'] = (bool) $config['absoluteUri']; |
95 | 95 | } |
96 | 96 | |
97 | - if( isset( $config['format'] ) ) { |
|
97 | + if (isset($config['format'])) { |
|
98 | 98 | $values['format'] = (string) $config['format']; |
99 | 99 | } |
100 | 100 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object |
33 | 33 | * @param \TYPO3\Flow\Cache\Frontend\StringFrontend $cache Flow cache object |
34 | 34 | */ |
35 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \TYPO3\Flow\Cache\Frontend\StringFrontend $cache ) |
|
35 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \TYPO3\Flow\Cache\Frontend\StringFrontend $cache) |
|
36 | 36 | { |
37 | 37 | $this->context = $context; |
38 | 38 | $this->cache = $cache; |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | */ |
47 | 47 | protected function getObject() |
48 | 48 | { |
49 | - if( !isset( $this->object ) ) |
|
49 | + if (!isset($this->object)) |
|
50 | 50 | { |
51 | 51 | $siteid = $this->context->getLocale()->getSiteId(); |
52 | - $conf = array( 'siteid' => $this->context->getConfig()->get( 'madmin/cache/prefix' ) . $siteid ); |
|
53 | - $this->object = \Aimeos\MW\Cache\Factory::createManager( 'Flow', $conf, $this->cache ); |
|
52 | + $conf = array('siteid' => $this->context->getConfig()->get('madmin/cache/prefix') . $siteid); |
|
53 | + $this->object = \Aimeos\MW\Cache\Factory::createManager('Flow', $conf, $this->cache); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | return $this->object; |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | */ |
26 | 26 | protected function setUp() |
27 | 27 | { |
28 | - if( class_exists( '\\TYPO3\\Flow\\Log\\Logger' ) === false ) { |
|
29 | - $this->markTestSkipped( 'Class \\TYPO3\\Flow\\Log\\Logger not found' ); |
|
28 | + if (class_exists('\\TYPO3\\Flow\\Log\\Logger') === false) { |
|
29 | + $this->markTestSkipped('Class \\TYPO3\\Flow\\Log\\Logger not found'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $be = new \TYPO3\Flow\Log\Backend\FileBackend(); |
33 | - $be->setSeverityThreshold( LOG_ERR ); |
|
34 | - $be->setLogFileURL( 'flow.log' ); |
|
33 | + $be->setSeverityThreshold(LOG_ERR); |
|
34 | + $be->setLogFileURL('flow.log'); |
|
35 | 35 | |
36 | 36 | $log = new \TYPO3\Flow\Log\Logger(); |
37 | - $log->addBackend( $be ); |
|
37 | + $log->addBackend($be); |
|
38 | 38 | |
39 | - $this->object = new \Aimeos\MW\Logger\Flow( $log ); |
|
39 | + $this->object = new \Aimeos\MW\Logger\Flow($log); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -48,53 +48,53 @@ discard block |
||
48 | 48 | */ |
49 | 49 | protected function tearDown() |
50 | 50 | { |
51 | - @unlink( 'flow.log' ); |
|
51 | + @unlink('flow.log'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function testLog() |
56 | 56 | { |
57 | - $this->object->log( 'error' ); |
|
58 | - $this->assertRegExp( '/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+error/', file_get_contents( 'flow.log' ) ); |
|
57 | + $this->object->log('error'); |
|
58 | + $this->assertRegExp('/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+error/', file_get_contents('flow.log')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testNonScalarLog() |
63 | 63 | { |
64 | - $this->object->log( array( 'error', 'error2', 2 ) ); |
|
65 | - $this->assertRegExp( '/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+\["error","error2",2\]/', file_get_contents( 'flow.log' ) ); |
|
64 | + $this->object->log(array('error', 'error2', 2)); |
|
65 | + $this->assertRegExp('/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+\["error","error2",2\]/', file_get_contents('flow.log')); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testLogDebug() |
70 | 70 | { |
71 | - $this->object->log( 'debug', \Aimeos\MW\Logger\Base::DEBUG ); |
|
72 | - $this->assertEquals( '', file_get_contents( 'flow.log' ) ); |
|
71 | + $this->object->log('debug', \Aimeos\MW\Logger\Base::DEBUG); |
|
72 | + $this->assertEquals('', file_get_contents('flow.log')); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | public function testBadPriority() |
77 | 77 | { |
78 | - $this->setExpectedException( '\\Aimeos\\MW\\Logger\\Exception' ); |
|
79 | - $this->object->log( 'error', -1 ); |
|
78 | + $this->setExpectedException('\\Aimeos\\MW\\Logger\\Exception'); |
|
79 | + $this->object->log('error', -1); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | 83 | public function testLogPriorityTranslate() |
84 | 84 | { |
85 | - $this->object->log( '', \Aimeos\MW\Logger\Base::EMERG ); |
|
86 | - $this->object->log( '', \Aimeos\MW\Logger\Base::ALERT ); |
|
87 | - $this->object->log( '', \Aimeos\MW\Logger\Base::CRIT ); |
|
88 | - $this->object->log( '', \Aimeos\MW\Logger\Base::ERR ); |
|
89 | - $this->object->log( '', \Aimeos\MW\Logger\Base::WARN ); |
|
90 | - $this->object->log( '', \Aimeos\MW\Logger\Base::NOTICE ); |
|
91 | - $this->object->log( '', \Aimeos\MW\Logger\Base::INFO ); |
|
92 | - $this->object->log( '', \Aimeos\MW\Logger\Base::DEBUG ); |
|
93 | - |
|
94 | - $content = file_get_contents( 'flow.log' ); |
|
95 | - $this->assertContains( 'EMERGENCY', $content ); |
|
96 | - $this->assertContains( 'ALERT', $content ); |
|
97 | - $this->assertContains( 'CRITICAL', $content ); |
|
98 | - $this->assertContains( 'ERROR', $content ); |
|
85 | + $this->object->log('', \Aimeos\MW\Logger\Base::EMERG); |
|
86 | + $this->object->log('', \Aimeos\MW\Logger\Base::ALERT); |
|
87 | + $this->object->log('', \Aimeos\MW\Logger\Base::CRIT); |
|
88 | + $this->object->log('', \Aimeos\MW\Logger\Base::ERR); |
|
89 | + $this->object->log('', \Aimeos\MW\Logger\Base::WARN); |
|
90 | + $this->object->log('', \Aimeos\MW\Logger\Base::NOTICE); |
|
91 | + $this->object->log('', \Aimeos\MW\Logger\Base::INFO); |
|
92 | + $this->object->log('', \Aimeos\MW\Logger\Base::DEBUG); |
|
93 | + |
|
94 | + $content = file_get_contents('flow.log'); |
|
95 | + $this->assertContains('EMERGENCY', $content); |
|
96 | + $this->assertContains('ALERT', $content); |
|
97 | + $this->assertContains('CRITICAL', $content); |
|
98 | + $this->assertContains('ERROR', $content); |
|
99 | 99 | } |
100 | 100 | } |