@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Cache cleanup' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Cache cleanup'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes the expired entries from the cache' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes the expired entries from the cache'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - \Aimeos\MAdmin\Cache\Manager\Factory::create( $this->getContext() )->getCache()->cleanup(); |
|
54 | + \Aimeos\MAdmin\Cache\Manager\Factory::create($this->getContext())->getCache()->cleanup(); |
|
55 | 55 | } |
56 | 56 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Log cleanup' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Log cleanup'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes the old log entries from the database and archives them (optional)' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes the old log entries from the database and archives them (optional)'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * @see controller/jobs/admin/log/standard/container/format |
72 | 72 | * @see controller/jobs/admin/log/standard/container/options |
73 | 73 | */ |
74 | - $limit = $config->get( 'controller/jobs/admin/log/standard/limit-days', 30 ); |
|
75 | - $limitDate = date( 'Y-m-d H:i:s', time() - $limit * 86400 ); |
|
74 | + $limit = $config->get('controller/jobs/admin/log/standard/limit-days', 30); |
|
75 | + $limitDate = date('Y-m-d H:i:s', time() - $limit * 86400); |
|
76 | 76 | |
77 | 77 | /** controller/jobs/admin/log/standard/path |
78 | 78 | * Path to a writable directory where the log archive files should be stored |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @see controller/jobs/admin/log/standard/container/options |
102 | 102 | * @see controller/jobs/admin/log/standard/limit-days |
103 | 103 | */ |
104 | - if( ( $path = $config->get( 'controller/jobs/admin/log/standard/path', null ) ) !== null ) |
|
104 | + if (($path = $config->get('controller/jobs/admin/log/standard/path', null)) !== null) |
|
105 | 105 | { |
106 | 106 | /** controller/jobs/admin/log/standard/container/type |
107 | 107 | * Container file type storing all coupon code files to import |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | * @see controller/jobs/admin/log/standard/limit-days |
176 | 176 | */ |
177 | 177 | |
178 | - $type = $config->get( 'controller/jobs/admin/log/standard/container/type', 'Zip' ); |
|
179 | - $format = $config->get( 'controller/jobs/admin/log/standard/container/format', 'CSV' ); |
|
180 | - $options = $config->get( 'controller/jobs/admin/log/standard/container/options', [] ); |
|
178 | + $type = $config->get('controller/jobs/admin/log/standard/container/type', 'Zip'); |
|
179 | + $format = $config->get('controller/jobs/admin/log/standard/container/format', 'CSV'); |
|
180 | + $options = $config->get('controller/jobs/admin/log/standard/container/options', []); |
|
181 | 181 | |
182 | - $path .= DIRECTORY_SEPARATOR . str_replace( ' ', '_', $limitDate ); |
|
183 | - $container = \Aimeos\MW\Container\Factory::getContainer( $path, $type, $format, $options ); |
|
182 | + $path .= DIRECTORY_SEPARATOR . str_replace(' ', '_', $limitDate); |
|
183 | + $container = \Aimeos\MW\Container\Factory::getContainer($path, $type, $format, $options); |
|
184 | 184 | } |
185 | 185 | |
186 | - $manager = \Aimeos\MAdmin::create( $context, 'log' ); |
|
186 | + $manager = \Aimeos\MAdmin::create($context, 'log'); |
|
187 | 187 | |
188 | 188 | $search = $manager->createSearch(); |
189 | - $search->setConditions( $search->compare( '<=', 'log.timestamp', $limitDate ) ); |
|
190 | - $search->setSortations( array( $search->sort( '+', 'log.timestamp' ) ) ); |
|
189 | + $search->setConditions($search->compare('<=', 'log.timestamp', $limitDate)); |
|
190 | + $search->setSortations(array($search->sort('+', 'log.timestamp'))); |
|
191 | 191 | |
192 | 192 | $start = 0; |
193 | 193 | $contents = []; |
@@ -195,37 +195,37 @@ discard block |
||
195 | 195 | do |
196 | 196 | { |
197 | 197 | $ids = []; |
198 | - $items = $manager->searchItems( $search ); |
|
198 | + $items = $manager->searchItems($search); |
|
199 | 199 | |
200 | - foreach( $items as $id => $item ) |
|
200 | + foreach ($items as $id => $item) |
|
201 | 201 | { |
202 | - if( $container !== null ) |
|
202 | + if ($container !== null) |
|
203 | 203 | { |
204 | 204 | $facility = $item->getFacility(); |
205 | 205 | |
206 | - if( !isset( $contents[$facility] ) ) { |
|
207 | - $contents[$facility] = $container->create( $facility ); |
|
206 | + if (!isset($contents[$facility])) { |
|
207 | + $contents[$facility] = $container->create($facility); |
|
208 | 208 | } |
209 | 209 | |
210 | - $contents[$facility]->add( $item->toArray() ); |
|
210 | + $contents[$facility]->add($item->toArray()); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $ids[] = $id; |
214 | 214 | } |
215 | 215 | |
216 | - $manager->deleteItems( $ids ); |
|
216 | + $manager->deleteItems($ids); |
|
217 | 217 | |
218 | - $count = count( $items ); |
|
218 | + $count = count($items); |
|
219 | 219 | $start += $count; |
220 | - $search->setSlice( $start ); |
|
220 | + $search->setSlice($start); |
|
221 | 221 | } |
222 | - while( $count >= $search->getSliceSize() ); |
|
222 | + while ($count >= $search->getSliceSize()); |
|
223 | 223 | |
224 | 224 | |
225 | - if( $container !== null && !empty( $contents ) ) |
|
225 | + if ($container !== null && !empty($contents)) |
|
226 | 226 | { |
227 | - foreach( $contents as $content ) { |
|
228 | - $container->add( $content ); |
|
227 | + foreach ($contents as $content) { |
|
228 | + $container->add($content); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | $container->close(); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Index optimization' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Index optimization'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Optimizes the index for searching products faster' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Optimizes the index for searching products faster'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - \Aimeos\MShop\Index\Manager\Factory::create( $this->getContext() )->optimize(); |
|
54 | + \Aimeos\MShop\Index\Manager\Factory::create($this->getContext())->optimize(); |
|
55 | 55 | } |
56 | 56 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Index rebuild' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Index rebuild'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rebuilds the index for searching products' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rebuilds the index for searching products'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - $timestamp = date( 'Y-m-d H:i:s' ); |
|
54 | + $timestamp = date('Y-m-d H:i:s'); |
|
55 | 55 | $context = clone $this->getContext(); |
56 | 56 | |
57 | - $context->getLocale()->setLanguageId( null ); |
|
58 | - $context->getLocale()->setCurrencyId( null ); |
|
57 | + $context->getLocale()->setLanguageId(null); |
|
58 | + $context->getLocale()->setCurrencyId(null); |
|
59 | 59 | |
60 | - $manager = \Aimeos\MShop\Index\Manager\Factory::create( $context ); |
|
60 | + $manager = \Aimeos\MShop\Index\Manager\Factory::create($context); |
|
61 | 61 | |
62 | 62 | $manager->rebuildIndex(); |
63 | - $manager->cleanupIndex( $timestamp ); |
|
63 | + $manager->cleanupIndex($timestamp); |
|
64 | 64 | } |
65 | 65 | } |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | public static function bootstrap() |
16 | 16 | { |
17 | 17 | self::getAimeos(); |
18 | - \Aimeos\MShop::cache( false ); |
|
18 | + \Aimeos\MShop::cache(false); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
22 | - public static function getContext( $site = 'unittest' ) |
|
22 | + public static function getContext($site = 'unittest') |
|
23 | 23 | { |
24 | - if( !isset( self::$context[$site] ) ) { |
|
25 | - self::$context[$site] = self::createContext( $site ); |
|
24 | + if (!isset(self::$context[$site])) { |
|
25 | + self::$context[$site] = self::createContext($site); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | return clone self::$context[$site]; |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | |
32 | 32 | public static function getAimeos() |
33 | 33 | { |
34 | - if( !isset( self::$aimeos ) ) |
|
34 | + if (!isset(self::$aimeos)) |
|
35 | 35 | { |
36 | 36 | require_once 'Bootstrap.php'; |
37 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
37 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
38 | 38 | |
39 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
40 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
39 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
40 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return self::$aimeos; |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | |
47 | 47 | public static function getControllerPaths() |
48 | 48 | { |
49 | - return self::getAimeos()->getCustomPaths( 'controller/jobs' ); |
|
49 | + return self::getAimeos()->getCustomPaths('controller/jobs'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @param string $site |
55 | 55 | */ |
56 | - private static function createContext( $site ) |
|
56 | + private static function createContext($site) |
|
57 | 57 | { |
58 | 58 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
59 | 59 | $aimeos = self::getAimeos(); |
@@ -63,80 +63,80 @@ discard block |
||
63 | 63 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
64 | 64 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
65 | 65 | |
66 | - $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
|
67 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
68 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
69 | - $ctx->setConfig( $conf ); |
|
66 | + $conf = new \Aimeos\MW\Config\PHPArray([], $paths); |
|
67 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
68 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
69 | + $ctx->setConfig($conf); |
|
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 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
77 | - $ctx->setDatabaseManager( $dbm ); |
|
76 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
77 | + $ctx->setDatabaseManager($dbm); |
|
78 | 78 | |
79 | 79 | |
80 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf ); |
|
81 | - $ctx->setFilesystemManager( $fs ); |
|
80 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf); |
|
81 | + $ctx->setFilesystemManager($fs); |
|
82 | 82 | |
83 | 83 | |
84 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
|
85 | - $ctx->setMessageQueueManager( $mq ); |
|
84 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($conf); |
|
85 | + $ctx->setMessageQueueManager($mq); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | $cache = new \Aimeos\MW\Cache\None(); |
89 | - $ctx->setCache( $cache ); |
|
89 | + $ctx->setCache($cache); |
|
90 | 90 | |
91 | 91 | |
92 | 92 | $session = new \Aimeos\MW\Session\None(); |
93 | - $ctx->setSession( $session ); |
|
93 | + $ctx->setSession($session); |
|
94 | 94 | |
95 | 95 | |
96 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
97 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
96 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
97 | + $ctx->setI18n(array('de' => $i18n)); |
|
98 | 98 | |
99 | 99 | |
100 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx ); |
|
101 | - $locale = $localeManager->bootstrap( $site, 'de', '', false ); |
|
102 | - $ctx->setLocale( $locale ); |
|
100 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create($ctx); |
|
101 | + $locale = $localeManager->bootstrap($site, 'de', '', false); |
|
102 | + $ctx->setLocale($locale); |
|
103 | 103 | |
104 | 104 | |
105 | - $view = self::createView( $conf ); |
|
106 | - $ctx->setView( $view ); |
|
105 | + $view = self::createView($conf); |
|
106 | + $ctx->setView($view); |
|
107 | 107 | |
108 | 108 | |
109 | - $ctx->setEditor( 'core:controller/jobs' ); |
|
109 | + $ctx->setEditor('core:controller/jobs'); |
|
110 | 110 | |
111 | 111 | return $ctx; |
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | - protected static function createView( \Aimeos\MW\Config\Iface $config ) |
|
115 | + protected static function createView(\Aimeos\MW\Config\Iface $config) |
|
116 | 116 | { |
117 | 117 | $tmplpaths = array_merge_recursive( |
118 | - self::getAimeos()->getCustomPaths( 'client/html/templates' ), |
|
119 | - self::getAimeos()->getCustomPaths( 'controller/jobs/templates' ) |
|
118 | + self::getAimeos()->getCustomPaths('client/html/templates'), |
|
119 | + self::getAimeos()->getCustomPaths('controller/jobs/templates') |
|
120 | 120 | ); |
121 | 121 | |
122 | - $view = new \Aimeos\MW\View\Standard( $tmplpaths ); |
|
122 | + $view = new \Aimeos\MW\View\Standard($tmplpaths); |
|
123 | 123 | |
124 | - $trans = new \Aimeos\MW\Translation\None( 'de_DE' ); |
|
125 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans ); |
|
126 | - $view->addHelper( 'translate', $helper ); |
|
124 | + $trans = new \Aimeos\MW\Translation\None('de_DE'); |
|
125 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); |
|
126 | + $view->addHelper('translate', $helper); |
|
127 | 127 | |
128 | - $helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' ); |
|
129 | - $view->addHelper( 'url', $helper ); |
|
128 | + $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); |
|
129 | + $view->addHelper('url', $helper); |
|
130 | 130 | |
131 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' ); |
|
132 | - $view->addHelper( 'number', $helper ); |
|
131 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); |
|
132 | + $view->addHelper('number', $helper); |
|
133 | 133 | |
134 | - $helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' ); |
|
135 | - $view->addHelper( 'date', $helper ); |
|
134 | + $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); |
|
135 | + $view->addHelper('date', $helper); |
|
136 | 136 | |
137 | - $config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'controller/jobs', 'client/html' ) ); |
|
138 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
139 | - $view->addHelper( 'config', $helper ); |
|
137 | + $config = new \Aimeos\MW\Config\Decorator\Protect($config, array('controller/jobs', 'client/html')); |
|
138 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
139 | + $view->addHelper('config', $helper); |
|
140 | 140 | |
141 | 141 | return $view; |
142 | 142 | } |
@@ -20,95 +20,95 @@ |
||
20 | 20 | $this->context = \TestHelperJobs::getContext(); |
21 | 21 | $aimeos = \TestHelperJobs::getAimeos(); |
22 | 22 | |
23 | - $this->object = new \Aimeos\Controller\Jobs\Subscription\Export\Csv\Standard( $this->context, $aimeos ); |
|
23 | + $this->object = new \Aimeos\Controller\Jobs\Subscription\Export\Csv\Standard($this->context, $aimeos); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | protected function tearDown() |
28 | 28 | { |
29 | - unset( $this->object, $this->context ); |
|
29 | + unset($this->object, $this->context); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | public function testGetName() |
34 | 34 | { |
35 | - $this->assertEquals( 'Subscription export CSV', $this->object->getName() ); |
|
35 | + $this->assertEquals('Subscription export CSV', $this->object->getName()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetDescription() |
40 | 40 | { |
41 | - $this->assertEquals( 'Exports subscriptions to CSV file', $this->object->getDescription() ); |
|
41 | + $this->assertEquals('Exports subscriptions to CSV file', $this->object->getDescription()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testRun() |
46 | 46 | { |
47 | - $mqmStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Manager\\Standard' ) |
|
48 | - ->setConstructorArgs( [$this->context->getConfig()] ) |
|
49 | - ->setMethods( ['get'] ) |
|
47 | + $mqmStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Manager\\Standard') |
|
48 | + ->setConstructorArgs([$this->context->getConfig()]) |
|
49 | + ->setMethods(['get']) |
|
50 | 50 | ->getMock(); |
51 | 51 | |
52 | - $mqStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Standard' ) |
|
52 | + $mqStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Standard') |
|
53 | 53 | ->disableOriginalConstructor() |
54 | - ->setMethods( ['getQueue'] ) |
|
54 | + ->setMethods(['getQueue']) |
|
55 | 55 | ->getMock(); |
56 | 56 | |
57 | - $queueStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Queue\\Standard' ) |
|
57 | + $queueStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Queue\\Standard') |
|
58 | 58 | ->disableOriginalConstructor() |
59 | - ->setMethods( ['del', 'get'] ) |
|
59 | + ->setMethods(['del', 'get']) |
|
60 | 60 | ->getMock(); |
61 | 61 | |
62 | - $msgStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Message\\Standard' ) |
|
62 | + $msgStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Message\\Standard') |
|
63 | 63 | ->disableOriginalConstructor() |
64 | - ->setMethods( ['getBody'] ) |
|
64 | + ->setMethods(['getBody']) |
|
65 | 65 | ->getMock(); |
66 | 66 | |
67 | 67 | |
68 | - $this->context->setMessageQueueManager( $mqmStub ); |
|
68 | + $this->context->setMessageQueueManager($mqmStub); |
|
69 | 69 | |
70 | 70 | |
71 | - $mqmStub->expects( $this->once() )->method( 'get' ) |
|
72 | - ->will( $this->returnValue( $mqStub ) ); |
|
71 | + $mqmStub->expects($this->once())->method('get') |
|
72 | + ->will($this->returnValue($mqStub)); |
|
73 | 73 | |
74 | - $mqStub->expects( $this->once() )->method( 'getQueue' ) |
|
75 | - ->will( $this->returnValue( $queueStub ) ); |
|
74 | + $mqStub->expects($this->once())->method('getQueue') |
|
75 | + ->will($this->returnValue($queueStub)); |
|
76 | 76 | |
77 | - $queueStub->expects( $this->exactly( 2 ) )->method( 'get' ) |
|
78 | - ->will( $this->onConsecutiveCalls( $msgStub, null ) ); |
|
77 | + $queueStub->expects($this->exactly(2))->method('get') |
|
78 | + ->will($this->onConsecutiveCalls($msgStub, null)); |
|
79 | 79 | |
80 | - $queueStub->expects( $this->once() )->method( 'del' ); |
|
80 | + $queueStub->expects($this->once())->method('del'); |
|
81 | 81 | |
82 | - $msgStub->expects( $this->once() )->method( 'getBody' ) |
|
83 | - ->will( $this->returnValue( '{"sitecode":"unittest"}' ) ); |
|
82 | + $msgStub->expects($this->once())->method('getBody') |
|
83 | + ->will($this->returnValue('{"sitecode":"unittest"}')); |
|
84 | 84 | |
85 | 85 | |
86 | 86 | $this->object->run(); |
87 | 87 | |
88 | 88 | |
89 | - $jobManager = \Aimeos\MAdmin::create( $this->context, 'job' ); |
|
89 | + $jobManager = \Aimeos\MAdmin::create($this->context, 'job'); |
|
90 | 90 | $jobSearch = $jobManager->createSearch(); |
91 | - $jobSearch->setConditions( $jobSearch->compare( '=~', 'job.label', 'subscription-export_' ) ); |
|
92 | - $jobItems = $jobManager->searchItems( $jobSearch ); |
|
93 | - $jobManager->deleteItems( array_keys( $jobItems ) ); |
|
91 | + $jobSearch->setConditions($jobSearch->compare('=~', 'job.label', 'subscription-export_')); |
|
92 | + $jobItems = $jobManager->searchItems($jobSearch); |
|
93 | + $jobManager->deleteItems(array_keys($jobItems)); |
|
94 | 94 | |
95 | - $this->assertEquals( 1, count( $jobItems ) ); |
|
95 | + $this->assertEquals(1, count($jobItems)); |
|
96 | 96 | |
97 | 97 | |
98 | - $filename = dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) . '/tmp/' . reset( $jobItems )->getLabel(); |
|
99 | - $fp = fopen( $filename, 'r' ); |
|
98 | + $filename = dirname(dirname(dirname(dirname(dirname(__DIR__))))) . '/tmp/' . reset($jobItems)->getLabel(); |
|
99 | + $fp = fopen($filename, 'r'); |
|
100 | 100 | |
101 | - $subscription = fgetcsv( $fp ); |
|
102 | - $address1 = fgetcsv( $fp ); |
|
103 | - $address2 = fgetcsv( $fp ); |
|
104 | - $product1 = fgetcsv( $fp ); |
|
101 | + $subscription = fgetcsv($fp); |
|
102 | + $address1 = fgetcsv($fp); |
|
103 | + $address2 = fgetcsv($fp); |
|
104 | + $product1 = fgetcsv($fp); |
|
105 | 105 | |
106 | - fclose( $fp ); |
|
107 | - unlink( $filename ); |
|
106 | + fclose($fp); |
|
107 | + unlink($filename); |
|
108 | 108 | |
109 | - $this->assertEquals( 'subscription', $subscription[0] ); |
|
110 | - $this->assertEquals( 'address', $address1[0] ); |
|
111 | - $this->assertEquals( 'address', $address2[0] ); |
|
112 | - $this->assertEquals( 'product', $product1[0] ); |
|
109 | + $this->assertEquals('subscription', $subscription[0]); |
|
110 | + $this->assertEquals('address', $address1[0]); |
|
111 | + $this->assertEquals('address', $address2[0]); |
|
112 | + $this->assertEquals('product', $product1[0]); |
|
113 | 113 | } |
114 | 114 | } |
@@ -20,109 +20,109 @@ |
||
20 | 20 | $this->context = \TestHelperJobs::getContext(); |
21 | 21 | $aimeos = \TestHelperJobs::getAimeos(); |
22 | 22 | |
23 | - $this->object = new \Aimeos\Controller\Jobs\Order\Export\Csv\Standard( $this->context, $aimeos ); |
|
23 | + $this->object = new \Aimeos\Controller\Jobs\Order\Export\Csv\Standard($this->context, $aimeos); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | protected function tearDown() |
28 | 28 | { |
29 | - unset( $this->object, $this->context ); |
|
29 | + unset($this->object, $this->context); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | public function testGetName() |
34 | 34 | { |
35 | - $this->assertEquals( 'Order export CSV', $this->object->getName() ); |
|
35 | + $this->assertEquals('Order export CSV', $this->object->getName()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetDescription() |
40 | 40 | { |
41 | - $this->assertEquals( 'Exports orders to CSV file', $this->object->getDescription() ); |
|
41 | + $this->assertEquals('Exports orders to CSV file', $this->object->getDescription()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testRun() |
46 | 46 | { |
47 | - $mqmStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Manager\\Standard' ) |
|
48 | - ->setConstructorArgs( [$this->context->getConfig()] ) |
|
49 | - ->setMethods( ['get'] ) |
|
47 | + $mqmStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Manager\\Standard') |
|
48 | + ->setConstructorArgs([$this->context->getConfig()]) |
|
49 | + ->setMethods(['get']) |
|
50 | 50 | ->getMock(); |
51 | 51 | |
52 | - $mqStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Standard' ) |
|
52 | + $mqStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Standard') |
|
53 | 53 | ->disableOriginalConstructor() |
54 | - ->setMethods( ['getQueue'] ) |
|
54 | + ->setMethods(['getQueue']) |
|
55 | 55 | ->getMock(); |
56 | 56 | |
57 | - $queueStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Queue\\Standard' ) |
|
57 | + $queueStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Queue\\Standard') |
|
58 | 58 | ->disableOriginalConstructor() |
59 | - ->setMethods( ['del', 'get'] ) |
|
59 | + ->setMethods(['del', 'get']) |
|
60 | 60 | ->getMock(); |
61 | 61 | |
62 | - $msgStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Message\\Standard' ) |
|
62 | + $msgStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Message\\Standard') |
|
63 | 63 | ->disableOriginalConstructor() |
64 | - ->setMethods( ['getBody'] ) |
|
64 | + ->setMethods(['getBody']) |
|
65 | 65 | ->getMock(); |
66 | 66 | |
67 | 67 | |
68 | - $this->context->setMessageQueueManager( $mqmStub ); |
|
68 | + $this->context->setMessageQueueManager($mqmStub); |
|
69 | 69 | |
70 | 70 | |
71 | - $mqmStub->expects( $this->once() )->method( 'get' ) |
|
72 | - ->will( $this->returnValue( $mqStub ) ); |
|
71 | + $mqmStub->expects($this->once())->method('get') |
|
72 | + ->will($this->returnValue($mqStub)); |
|
73 | 73 | |
74 | - $mqStub->expects( $this->once() )->method( 'getQueue' ) |
|
75 | - ->will( $this->returnValue( $queueStub ) ); |
|
74 | + $mqStub->expects($this->once())->method('getQueue') |
|
75 | + ->will($this->returnValue($queueStub)); |
|
76 | 76 | |
77 | - $queueStub->expects( $this->exactly( 2 ) )->method( 'get' ) |
|
78 | - ->will( $this->onConsecutiveCalls( $msgStub, null ) ); |
|
77 | + $queueStub->expects($this->exactly(2))->method('get') |
|
78 | + ->will($this->onConsecutiveCalls($msgStub, null)); |
|
79 | 79 | |
80 | - $queueStub->expects( $this->once() )->method( 'del' ); |
|
80 | + $queueStub->expects($this->once())->method('del'); |
|
81 | 81 | |
82 | - $msgStub->expects( $this->once() )->method( 'getBody' ) |
|
83 | - ->will( $this->returnValue( '{"sitecode":"unittest"}' ) ); |
|
82 | + $msgStub->expects($this->once())->method('getBody') |
|
83 | + ->will($this->returnValue('{"sitecode":"unittest"}')); |
|
84 | 84 | |
85 | 85 | |
86 | 86 | $this->object->run(); |
87 | 87 | |
88 | 88 | |
89 | - $jobManager = \Aimeos\MAdmin::create( $this->context, 'job' ); |
|
89 | + $jobManager = \Aimeos\MAdmin::create($this->context, 'job'); |
|
90 | 90 | $jobSearch = $jobManager->createSearch(); |
91 | - $jobSearch->setConditions( $jobSearch->compare( '=~', 'job.label', 'order-export_' ) ); |
|
92 | - $jobItems = $jobManager->searchItems( $jobSearch ); |
|
93 | - $jobManager->deleteItems( array_keys( $jobItems ) ); |
|
91 | + $jobSearch->setConditions($jobSearch->compare('=~', 'job.label', 'order-export_')); |
|
92 | + $jobItems = $jobManager->searchItems($jobSearch); |
|
93 | + $jobManager->deleteItems(array_keys($jobItems)); |
|
94 | 94 | |
95 | - $this->assertEquals( 1, count( $jobItems ) ); |
|
95 | + $this->assertEquals(1, count($jobItems)); |
|
96 | 96 | |
97 | 97 | |
98 | - $filename = dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) . '/tmp/' . reset( $jobItems )->getLabel(); |
|
99 | - $fp = fopen( $filename, 'r' ); |
|
98 | + $filename = dirname(dirname(dirname(dirname(dirname(__DIR__))))) . '/tmp/' . reset($jobItems)->getLabel(); |
|
99 | + $fp = fopen($filename, 'r'); |
|
100 | 100 | |
101 | - $invoice = fgetcsv( $fp ); |
|
102 | - $address1 = fgetcsv( $fp ); |
|
103 | - $address2 = fgetcsv( $fp ); |
|
104 | - $service1 = fgetcsv( $fp ); |
|
105 | - $service2 = fgetcsv( $fp ); |
|
101 | + $invoice = fgetcsv($fp); |
|
102 | + $address1 = fgetcsv($fp); |
|
103 | + $address2 = fgetcsv($fp); |
|
104 | + $service1 = fgetcsv($fp); |
|
105 | + $service2 = fgetcsv($fp); |
|
106 | 106 | $coupon1 = fgetcsv($fp); |
107 | 107 | $coupon2 = fgetcsv($fp); |
108 | - $product1 = fgetcsv( $fp ); |
|
109 | - $product2 = fgetcsv( $fp ); |
|
110 | - $product3 = fgetcsv( $fp ); |
|
111 | - $product4 = fgetcsv( $fp ); |
|
112 | - |
|
113 | - fclose( $fp ); |
|
114 | - unlink( $filename ); |
|
115 | - |
|
116 | - $this->assertEquals( 'invoice', $invoice[0] ); |
|
117 | - $this->assertEquals( 'address', $address1[0] ); |
|
118 | - $this->assertEquals( 'address', $address2[0] ); |
|
119 | - $this->assertEquals( 'service', $service1[0] ); |
|
120 | - $this->assertEquals( 'service', $service2[0] ); |
|
121 | - $this->assertEquals( 'coupon', $coupon1[0]); |
|
122 | - $this->assertEquals( 'coupon', $coupon2[0]); |
|
123 | - $this->assertEquals( 'product', $product1[0] ); |
|
124 | - $this->assertEquals( 'product', $product2[0] ); |
|
125 | - $this->assertEquals( 'product', $product3[0] ); |
|
126 | - $this->assertEquals( 'product', $product4[0] ); |
|
108 | + $product1 = fgetcsv($fp); |
|
109 | + $product2 = fgetcsv($fp); |
|
110 | + $product3 = fgetcsv($fp); |
|
111 | + $product4 = fgetcsv($fp); |
|
112 | + |
|
113 | + fclose($fp); |
|
114 | + unlink($filename); |
|
115 | + |
|
116 | + $this->assertEquals('invoice', $invoice[0]); |
|
117 | + $this->assertEquals('address', $address1[0]); |
|
118 | + $this->assertEquals('address', $address2[0]); |
|
119 | + $this->assertEquals('service', $service1[0]); |
|
120 | + $this->assertEquals('service', $service2[0]); |
|
121 | + $this->assertEquals('coupon', $coupon1[0]); |
|
122 | + $this->assertEquals('coupon', $coupon2[0]); |
|
123 | + $this->assertEquals('product', $product1[0]); |
|
124 | + $this->assertEquals('product', $product2[0]); |
|
125 | + $this->assertEquals('product', $product3[0]); |
|
126 | + $this->assertEquals('product', $product4[0]); |
|
127 | 127 | } |
128 | 128 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string|null $name Name of the controller or "Standard" if null |
30 | 30 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
31 | 31 | */ |
32 | - public static function create( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
32 | + public static function create(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
33 | 33 | { |
34 | 34 | /** controller/jobs/product/import/csv/name |
35 | 35 | * Class name of the used product suggestions scheduler controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | * @since 2015.01 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if ( $name === null ) { |
|
67 | + if ($name === null) { |
|
68 | 68 | $name = $context->getConfig()->get('controller/jobs/product/import/csv/name', 'Standard'); |
69 | 69 | } |
70 | 70 | |
71 | - if ( ctype_alnum($name) === false ) |
|
71 | + if (ctype_alnum($name) === false) |
|
72 | 72 | { |
73 | 73 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Product\\Import\\Csv\\' . $name : '<not a string>'; |
74 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
74 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
78 | 78 | $classname = '\\Aimeos\\Controller\\Jobs\\Product\\Import\\Csv\\' . $name; |
79 | 79 | |
80 | - $controller = self::createController( $context, $aimeos, $classname, $iface ); |
|
80 | + $controller = self::createController($context, $aimeos, $classname, $iface); |
|
81 | 81 | |
82 | 82 | /** controller/jobs/product/import/csv/decorators/excludes |
83 | 83 | * Excludes decorators added by the "common" option from the product import CSV job controller |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/product/import/csv/decorators/excludes |
155 | 155 | * @see controller/jobs/product/import/csv/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'product/import/csv' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'product/import/csv'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string|null $name Name of the controller or "Standard" if null |
30 | 30 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
31 | 31 | */ |
32 | - public static function create( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
32 | + public static function create(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
33 | 33 | { |
34 | 34 | /** controller/jobs/product/export/sitemap/name |
35 | 35 | * Class name of the used product suggestions scheduler controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | * @since 2015.01 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if ( $name === null ) { |
|
67 | + if ($name === null) { |
|
68 | 68 | $name = $context->getConfig()->get('controller/jobs/product/export/sitemap/name', 'Standard'); |
69 | 69 | } |
70 | 70 | |
71 | - if ( ctype_alnum($name) === false ) |
|
71 | + if (ctype_alnum($name) === false) |
|
72 | 72 | { |
73 | 73 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Product\\Export\\Sitemap\\' . $name : '<not a string>'; |
74 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
74 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
78 | 78 | $classname = '\\Aimeos\\Controller\\Jobs\\Product\\Export\\Sitemap\\' . $name; |
79 | 79 | |
80 | - $controller = self::createController( $context, $aimeos, $classname, $iface ); |
|
80 | + $controller = self::createController($context, $aimeos, $classname, $iface); |
|
81 | 81 | |
82 | 82 | /** controller/jobs/product/export/sitemap/decorators/excludes |
83 | 83 | * Excludes decorators added by the "common" option from the product export sitemap job controller |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/product/export/sitemap/export/sitemap/decorators/excludes |
155 | 155 | * @see controller/jobs/product/export/sitemap/export/sitemap/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'product/export/sitemap' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'product/export/sitemap'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |