Completed
Push — master ( 6c75b7...90deda )
by Aimeos
15:40 queued 12:37
created
controller/jobs/tests/TestHelperJobs.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 	public static function bootstrap()
16 16
 	{
17 17
 		self::getAimeos();
18
-		\Aimeos\MShop\Factory::setCache( false );
18
+		\Aimeos\MShop\Factory::setCache(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
 block discarded – undo
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
 block discarded – undo
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,76 +63,76 @@  discard block
 block discarded – undo
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
 		$session = new \Aimeos\MW\Session\None();
89
-		$ctx->setSession( $session );
89
+		$ctx->setSession($session);
90 90
 
91 91
 
92
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
93
-		$ctx->setI18n( array( 'de' => $i18n ) );
92
+		$i18n = new \Aimeos\MW\Translation\None('de');
93
+		$ctx->setI18n(array('de' => $i18n));
94 94
 
95 95
 
96
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
97
-		$locale = $localeManager->bootstrap( $site, 'de', '', false );
98
-		$ctx->setLocale( $locale );
96
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
97
+		$locale = $localeManager->bootstrap($site, 'de', '', false);
98
+		$ctx->setLocale($locale);
99 99
 
100 100
 
101
-		$view = self::createView( $conf );
102
-		$ctx->setView( $view );
101
+		$view = self::createView($conf);
102
+		$ctx->setView($view);
103 103
 
104 104
 
105
-		$ctx->setEditor( 'core:controller/jobs' );
105
+		$ctx->setEditor('core:controller/jobs');
106 106
 
107 107
 		return $ctx;
108 108
 	}
109 109
 
110 110
 
111
-	protected static function createView( \Aimeos\MW\Config\Iface $config )
111
+	protected static function createView(\Aimeos\MW\Config\Iface $config)
112 112
 	{
113 113
 		$tmplpaths = array_merge_recursive(
114
-			self::getAimeos()->getCustomPaths( 'client/html/templates' ),
115
-			self::getAimeos()->getCustomPaths( 'controller/jobs/templates' )
114
+			self::getAimeos()->getCustomPaths('client/html/templates'),
115
+			self::getAimeos()->getCustomPaths('controller/jobs/templates')
116 116
 		);
117 117
 
118
-		$view = new \Aimeos\MW\View\Standard( $tmplpaths );
118
+		$view = new \Aimeos\MW\View\Standard($tmplpaths);
119 119
 
120
-		$trans = new \Aimeos\MW\Translation\None( 'de_DE' );
121
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans );
122
-		$view->addHelper( 'translate', $helper );
120
+		$trans = new \Aimeos\MW\Translation\None('de_DE');
121
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans);
122
+		$view->addHelper('translate', $helper);
123 123
 
124
-		$helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' );
125
-		$view->addHelper( 'url', $helper );
124
+		$helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl');
125
+		$view->addHelper('url', $helper);
126 126
 
127
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' );
128
-		$view->addHelper( 'number', $helper );
127
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', '');
128
+		$view->addHelper('number', $helper);
129 129
 
130
-		$helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' );
131
-		$view->addHelper( 'date', $helper );
130
+		$helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d');
131
+		$view->addHelper('date', $helper);
132 132
 
133
-		$config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'controller/jobs', 'client/html' ) );
134
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
135
-		$view->addHelper( 'config', $helper );
133
+		$config = new \Aimeos\MW\Config\Decorator\Protect($config, array('controller/jobs', 'client/html'));
134
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
135
+		$view->addHelper('config', $helper);
136 136
 
137 137
 		return $view;
138 138
 	}
Please login to merge, or discard this patch.
controller/jobs/tests/Controller/Jobs/Order/Export/Csv/StandardTest.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -20,105 +20,105 @@
 block discarded – undo
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\Factory::createManager( $this->context, 'job' );
89
+		$jobManager = \Aimeos\MAdmin\Factory::createManager($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 ) );
94
-
95
-		$this->assertEquals( 1, count( $jobItems ) );
96
-
97
-
98
-		$filename = dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) . '/tmp/' . reset( $jobItems )->getLabel();
99
-		$fp = fopen( $filename, 'r' );
100
-
101
-		$invoice = fgetcsv( $fp );
102
-		$address1 = fgetcsv( $fp );
103
-		$address2 = fgetcsv( $fp );
104
-		$service1 = fgetcsv( $fp );
105
-		$service2 = fgetcsv( $fp );
106
-		$product1 = fgetcsv( $fp );
107
-		$product2 = fgetcsv( $fp );
108
-		$product3 = fgetcsv( $fp );
109
-		$product4 = fgetcsv( $fp );
110
-
111
-		fclose( $fp );
112
-		unlink( $filename );
113
-
114
-		$this->assertEquals( 'invoice', $invoice[0] );
115
-		$this->assertEquals( 'address', $address1[0] );
116
-		$this->assertEquals( 'address', $address2[0] );
117
-		$this->assertEquals( 'service', $service1[0] );
118
-		$this->assertEquals( 'service', $service2[0] );
119
-		$this->assertEquals( 'product', $product1[0] );
120
-		$this->assertEquals( 'product', $product2[0] );
121
-		$this->assertEquals( 'product', $product3[0] );
122
-		$this->assertEquals( 'product', $product4[0] );
91
+		$jobSearch->setConditions($jobSearch->compare('=~', 'job.label', 'order-export_'));
92
+		$jobItems = $jobManager->searchItems($jobSearch);
93
+		$jobManager->deleteItems(array_keys($jobItems));
94
+
95
+		$this->assertEquals(1, count($jobItems));
96
+
97
+
98
+		$filename = dirname(dirname(dirname(dirname(dirname(__DIR__))))) . '/tmp/' . reset($jobItems)->getLabel();
99
+		$fp = fopen($filename, 'r');
100
+
101
+		$invoice = fgetcsv($fp);
102
+		$address1 = fgetcsv($fp);
103
+		$address2 = fgetcsv($fp);
104
+		$service1 = fgetcsv($fp);
105
+		$service2 = fgetcsv($fp);
106
+		$product1 = fgetcsv($fp);
107
+		$product2 = fgetcsv($fp);
108
+		$product3 = fgetcsv($fp);
109
+		$product4 = fgetcsv($fp);
110
+
111
+		fclose($fp);
112
+		unlink($filename);
113
+
114
+		$this->assertEquals('invoice', $invoice[0]);
115
+		$this->assertEquals('address', $address1[0]);
116
+		$this->assertEquals('address', $address2[0]);
117
+		$this->assertEquals('service', $service1[0]);
118
+		$this->assertEquals('service', $service2[0]);
119
+		$this->assertEquals('product', $product1[0]);
120
+		$this->assertEquals('product', $product2[0]);
121
+		$this->assertEquals('product', $product3[0]);
122
+		$this->assertEquals('product', $product4[0]);
123 123
 	}
124 124
 }
Please login to merge, or discard this patch.
controller/jobs/tests/Controller/Jobs/Order/Export/Csv/FactoryTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$context = \TestHelperJobs::getContext();
17 17
 		$aimeos = \TestHelperJobs::getAimeos();
18 18
 
19
-		$obj = \Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController( $context, $aimeos );
20
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj );
19
+		$obj = \Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController($context, $aimeos);
20
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Jobs\\Iface', $obj);
21 21
 	}
22 22
 
23 23
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 		$context = \TestHelperJobs::getContext();
27 27
 		$aimeos = \TestHelperJobs::getAimeos();
28 28
 
29
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
30
-		\Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController( $context, $aimeos, 'Wrong$$$Name' );
29
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
30
+		\Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController($context, $aimeos, 'Wrong$$$Name');
31 31
 	}
32 32
 
33 33
 
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 		$context = \TestHelperJobs::getContext();
37 37
 		$aimeos = \TestHelperJobs::getAimeos();
38 38
 
39
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
40
-		\Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController( $context, $aimeos, 'WrongClass' );
39
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
40
+		\Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController($context, $aimeos, 'WrongClass');
41 41
 	}
42 42
 
43 43
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 		$context = \TestHelperJobs::getContext();
47 47
 		$aimeos = \TestHelperJobs::getAimeos();
48 48
 
49
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
50
-		\Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController( $context, $aimeos, 'Factory' );
49
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
50
+		\Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController($context, $aimeos, 'Factory');
51 51
 	}
52 52
 
53 53
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Order/Export/Csv/Base.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -151,39 +151,39 @@
 block discarded – undo
151 151
 	 * @param array $mappings Associative list of processor types as keys and index/data mappings as values
152 152
 	 * @return \Aimeos\Controller\Common\Order\Export\Csv\Processor\Iface Processor object
153 153
 	 */
154
-	protected function getProcessors( array $mappings )
154
+	protected function getProcessors(array $mappings)
155 155
 	{
156 156
 		$list = [];
157 157
 		$context = $this->getContext();
158 158
 		$config = $context->getConfig();
159 159
 		$iface = '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\Iface';
160 160
 
161
-		foreach( $mappings as $type => $mapping )
161
+		foreach ($mappings as $type => $mapping)
162 162
 		{
163
-			if( ctype_alnum( $type ) === false )
163
+			if (ctype_alnum($type) === false)
164 164
 			{
165 165
 				$classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . $type : '<not a string>';
166
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
166
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
167 167
 			}
168 168
 
169
-			$name = $config->get( 'controller/common/order/export/csv/processor/' . $type . '/name', 'Standard' );
169
+			$name = $config->get('controller/common/order/export/csv/processor/' . $type . '/name', 'Standard');
170 170
 
171
-			if( ctype_alnum( $name ) === false )
171
+			if (ctype_alnum($name) === false)
172 172
 			{
173 173
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>';
174
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
174
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
175 175
 			}
176 176
 
177
-			$classname = '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name;
177
+			$classname = '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name;
178 178
 
179
-			if( class_exists( $classname ) === false ) {
180
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
179
+			if (class_exists($classname) === false) {
180
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
181 181
 			}
182 182
 
183
-			$object = new $classname( $context, $mapping );
183
+			$object = new $classname($context, $mapping);
184 184
 
185
-			if( !( $object instanceof $iface ) ) {
186
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) );
185
+			if (!($object instanceof $iface)) {
186
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $iface));
187 187
 			}
188 188
 
189 189
 			$list[$type] = $object;
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Order/Export/Csv/Factory.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 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 createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null )
32
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null)
33 33
 	{
34 34
 		/** controller/jobs/order/export/csv/name
35 35
 		 * Class name of the used order suggestions scheduler controller implementation
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
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/order/export/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\\Order\\Export\\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\\Order\\Export\\Csv\\' . $name;
79 79
 
80
-		$controller = self::createControllerBase( $context, $aimeos, $classname, $iface );
80
+		$controller = self::createControllerBase($context, $aimeos, $classname, $iface);
81 81
 
82 82
 		/** controller/jobs/order/export/csv/decorators/excludes
83 83
 		 * Excludes decorators added by the "common" option from the order export CSV job controller
@@ -154,6 +154,6 @@  discard block
 block discarded – undo
154 154
 		 * @see controller/jobs/order/export/csv/decorators/excludes
155 155
 		 * @see controller/jobs/order/export/csv/decorators/global
156 156
 		 */
157
-		return self::addControllerDecorators( $context, $aimeos, $controller, 'order/export/csv' );
157
+		return self::addControllerDecorators($context, $aimeos, $controller, 'order/export/csv');
158 158
 	}
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
tests/Controller/Common/Order/Export/Csv/Processor/Coupon/StandardTest.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,37 +18,37 @@
 block discarded – undo
18 18
 		);
19 19
 
20 20
 
21
-		$object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Coupon\Standard( $context, $mapping );
21
+		$object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Coupon\Standard($context, $mapping);
22 22
 
23
-		$invoice = $this->getInvoice( $context );
24
-		$order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() );
23
+		$invoice = $this->getInvoice($context);
24
+		$order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId());
25 25
 
26
-		$data = $object->process( $invoice, $order );
26
+		$data = $object->process($invoice, $order);
27 27
 
28 28
 
29
-		$this->assertEquals( 2, count( $data ) );
29
+		$this->assertEquals(2, count($data));
30 30
 
31
-		$this->assertEquals( 1, count( $data[0] ) );
32
-		$this->assertEquals( '5678', $data[0][0] );
31
+		$this->assertEquals(1, count($data[0]));
32
+		$this->assertEquals('5678', $data[0][0]);
33 33
 
34
-		$this->assertEquals( 1, count( $data[1] ) );
35
-		$this->assertEquals( 'OPQR', $data[1][0] );
34
+		$this->assertEquals(1, count($data[1]));
35
+		$this->assertEquals('OPQR', $data[1][0]);
36 36
 	}
37 37
 
38 38
 
39
-	protected function getInvoice( $context )
39
+	protected function getInvoice($context)
40 40
 	{
41
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
41
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
42 42
 
43 43
 		$search = $manager->createSearch();
44
-		$search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) );
44
+		$search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56'));
45 45
 
46
-		$items = $manager->searchItems( $search );
46
+		$items = $manager->searchItems($search);
47 47
 
48
-		if( ( $item = reset( $items ) ) !== false ) {
48
+		if (($item = reset($items)) !== false) {
49 49
 			return $item;
50 50
 		}
51 51
 
52
-		throw new \Exception( 'No order item found' );
52
+		throw new \Exception('No order item found');
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.
tests/Controller/Common/Order/Export/Csv/Processor/Address/StandardTest.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -38,77 +38,77 @@
 block discarded – undo
38 38
 		);
39 39
 
40 40
 
41
-		$object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Address\Standard( $context, $mapping );
42
-
43
-		$invoice = $this->getInvoice( $context );
44
-		$order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() );
45
-
46
-		$data = $object->process( $invoice, $order );
47
-
48
-
49
-		$this->assertEquals( 2, count( $data ) );
50
-
51
-		$this->assertEquals( 21, count( $data[0] ) );
52
-		$this->assertEquals( 'payment', $data[0][0] );
53
-		$this->assertEquals( 'mr', $data[0][1] );
54
-		$this->assertEquals( '', $data[0][2] );
55
-		$this->assertEquals( '', $data[0][3] );
56
-		$this->assertEquals( '', $data[0][4] );
57
-		$this->assertEquals( 'Our', $data[0][5] );
58
-		$this->assertEquals( 'Unittest', $data[0][6] );
59
-		$this->assertEquals( 'Durchschnitt', $data[0][7] );
60
-		$this->assertEquals( '1', $data[0][8] );
61
-		$this->assertEquals( '', $data[0][9] );
62
-		$this->assertEquals( '20146', $data[0][10] );
63
-		$this->assertEquals( 'Hamburg', $data[0][11] );
64
-		$this->assertEquals( 'Hamburg', $data[0][12] );
65
-		$this->assertEquals( 'DE', $data[0][13] );
66
-		$this->assertEquals( 'de', $data[0][14] );
67
-		$this->assertEquals( '055544332211', $data[0][15] );
68
-		$this->assertEquals( '055544332213', $data[0][16] );
69
-		$this->assertEquals( '[email protected]', $data[0][17] );
70
-		$this->assertEquals( 'www.metaways.net', $data[0][18] );
71
-		$this->assertEquals( '11.000000', $data[0][19] );
72
-		$this->assertEquals( '52.000000', $data[0][20] );
73
-
74
-		$this->assertEquals( 21, count( $data[1] ) );
75
-		$this->assertEquals( 'delivery', $data[1][0] );
76
-		$this->assertEquals( 'mr', $data[1][1] );
77
-		$this->assertEquals( 'Example company', $data[1][2] );
78
-		$this->assertEquals( 'DE999999999', $data[1][3] );
79
-		$this->assertEquals( 'Dr.', $data[1][4] );
80
-		$this->assertEquals( 'Our', $data[1][5] );
81
-		$this->assertEquals( 'Unittest', $data[1][6] );
82
-		$this->assertEquals( 'Pickhuben', $data[1][7] );
83
-		$this->assertEquals( '2-4', $data[1][8] );
84
-		$this->assertEquals( '', $data[1][9] );
85
-		$this->assertEquals( '20457', $data[1][10] );
86
-		$this->assertEquals( 'Hamburg', $data[1][11] );
87
-		$this->assertEquals( 'Hamburg', $data[1][12] );
88
-		$this->assertEquals( 'DE', $data[1][13] );
89
-		$this->assertEquals( 'de', $data[1][14] );
90
-		$this->assertEquals( '055544332211', $data[1][15] );
91
-		$this->assertEquals( '055544332212', $data[1][16] );
92
-		$this->assertEquals( '[email protected]', $data[1][17] );
93
-		$this->assertEquals( 'www.example.com', $data[1][18] );
94
-		$this->assertEquals( '10.000000', $data[1][19] );
95
-		$this->assertEquals( '50.000000', $data[1][20] );
41
+		$object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Address\Standard($context, $mapping);
42
+
43
+		$invoice = $this->getInvoice($context);
44
+		$order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId());
45
+
46
+		$data = $object->process($invoice, $order);
47
+
48
+
49
+		$this->assertEquals(2, count($data));
50
+
51
+		$this->assertEquals(21, count($data[0]));
52
+		$this->assertEquals('payment', $data[0][0]);
53
+		$this->assertEquals('mr', $data[0][1]);
54
+		$this->assertEquals('', $data[0][2]);
55
+		$this->assertEquals('', $data[0][3]);
56
+		$this->assertEquals('', $data[0][4]);
57
+		$this->assertEquals('Our', $data[0][5]);
58
+		$this->assertEquals('Unittest', $data[0][6]);
59
+		$this->assertEquals('Durchschnitt', $data[0][7]);
60
+		$this->assertEquals('1', $data[0][8]);
61
+		$this->assertEquals('', $data[0][9]);
62
+		$this->assertEquals('20146', $data[0][10]);
63
+		$this->assertEquals('Hamburg', $data[0][11]);
64
+		$this->assertEquals('Hamburg', $data[0][12]);
65
+		$this->assertEquals('DE', $data[0][13]);
66
+		$this->assertEquals('de', $data[0][14]);
67
+		$this->assertEquals('055544332211', $data[0][15]);
68
+		$this->assertEquals('055544332213', $data[0][16]);
69
+		$this->assertEquals('[email protected]', $data[0][17]);
70
+		$this->assertEquals('www.metaways.net', $data[0][18]);
71
+		$this->assertEquals('11.000000', $data[0][19]);
72
+		$this->assertEquals('52.000000', $data[0][20]);
73
+
74
+		$this->assertEquals(21, count($data[1]));
75
+		$this->assertEquals('delivery', $data[1][0]);
76
+		$this->assertEquals('mr', $data[1][1]);
77
+		$this->assertEquals('Example company', $data[1][2]);
78
+		$this->assertEquals('DE999999999', $data[1][3]);
79
+		$this->assertEquals('Dr.', $data[1][4]);
80
+		$this->assertEquals('Our', $data[1][5]);
81
+		$this->assertEquals('Unittest', $data[1][6]);
82
+		$this->assertEquals('Pickhuben', $data[1][7]);
83
+		$this->assertEquals('2-4', $data[1][8]);
84
+		$this->assertEquals('', $data[1][9]);
85
+		$this->assertEquals('20457', $data[1][10]);
86
+		$this->assertEquals('Hamburg', $data[1][11]);
87
+		$this->assertEquals('Hamburg', $data[1][12]);
88
+		$this->assertEquals('DE', $data[1][13]);
89
+		$this->assertEquals('de', $data[1][14]);
90
+		$this->assertEquals('055544332211', $data[1][15]);
91
+		$this->assertEquals('055544332212', $data[1][16]);
92
+		$this->assertEquals('[email protected]', $data[1][17]);
93
+		$this->assertEquals('www.example.com', $data[1][18]);
94
+		$this->assertEquals('10.000000', $data[1][19]);
95
+		$this->assertEquals('50.000000', $data[1][20]);
96 96
 	}
97 97
 
98 98
 
99
-	protected function getInvoice( $context )
99
+	protected function getInvoice($context)
100 100
 	{
101
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
101
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
102 102
 
103 103
 		$search = $manager->createSearch();
104
-		$search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) );
104
+		$search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56'));
105 105
 
106
-		$items = $manager->searchItems( $search );
106
+		$items = $manager->searchItems($search);
107 107
 
108
-		if( ( $item = reset( $items ) ) !== false ) {
108
+		if (($item = reset($items)) !== false) {
109 109
 			return $item;
110 110
 		}
111 111
 
112
-		throw new \Exception( 'No order item found' );
112
+		throw new \Exception('No order item found');
113 113
 	}
114 114
 }
Please login to merge, or discard this patch.
tests/Controller/Common/Order/Export/Csv/Processor/Invoice/StandardTest.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -34,50 +34,50 @@
 block discarded – undo
34 34
 		);
35 35
 
36 36
 
37
-		$object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Invoice\Standard( $context, $mapping );
38
-
39
-		$invoice = $this->getInvoice( $context );
40
-		$order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() );
41
-
42
-		$data = $object->process( $invoice, $order );
43
-
44
-
45
-		$this->assertEquals( 1, count( $data ) );
46
-
47
-		$this->assertEquals( 17, count( $data[0] ) );
48
-		$this->assertEquals( 'web', $data[0][0] );
49
-		$this->assertEquals( '2008-02-15 12:34:56', $data[0][1] );
50
-		$this->assertEquals( '6', $data[0][2] );
51
-		$this->assertEquals( '', $data[0][3] );
52
-		$this->assertEquals( '4', $data[0][4] );
53
-		$this->assertEquals( '', $data[0][5] );
54
-		$this->assertGreaterThan( 0, $data[0][6] );
55
-		$this->assertEquals( 'unittest', $data[0][7] );
56
-		$this->assertEquals( 'de', $data[0][8] );
57
-		$this->assertEquals( 'EUR', $data[0][9] );
58
-		$this->assertEquals( '53.50', $data[0][10] );
59
-		$this->assertEquals( '1.50', $data[0][11] );
60
-		$this->assertEquals( '14.50', $data[0][12] );
61
-		$this->assertEquals( '0.0000', $data[0][13] );
62
-		$this->assertEquals( '1', $data[0][14] );
63
-		$this->assertEquals( '0', $data[0][15] );
64
-		$this->assertEquals( 'This is a comment if an order. It can be added by the user.', $data[0][16] );
37
+		$object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Invoice\Standard($context, $mapping);
38
+
39
+		$invoice = $this->getInvoice($context);
40
+		$order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId());
41
+
42
+		$data = $object->process($invoice, $order);
43
+
44
+
45
+		$this->assertEquals(1, count($data));
46
+
47
+		$this->assertEquals(17, count($data[0]));
48
+		$this->assertEquals('web', $data[0][0]);
49
+		$this->assertEquals('2008-02-15 12:34:56', $data[0][1]);
50
+		$this->assertEquals('6', $data[0][2]);
51
+		$this->assertEquals('', $data[0][3]);
52
+		$this->assertEquals('4', $data[0][4]);
53
+		$this->assertEquals('', $data[0][5]);
54
+		$this->assertGreaterThan(0, $data[0][6]);
55
+		$this->assertEquals('unittest', $data[0][7]);
56
+		$this->assertEquals('de', $data[0][8]);
57
+		$this->assertEquals('EUR', $data[0][9]);
58
+		$this->assertEquals('53.50', $data[0][10]);
59
+		$this->assertEquals('1.50', $data[0][11]);
60
+		$this->assertEquals('14.50', $data[0][12]);
61
+		$this->assertEquals('0.0000', $data[0][13]);
62
+		$this->assertEquals('1', $data[0][14]);
63
+		$this->assertEquals('0', $data[0][15]);
64
+		$this->assertEquals('This is a comment if an order. It can be added by the user.', $data[0][16]);
65 65
 	}
66 66
 
67 67
 
68
-	protected function getInvoice( $context )
68
+	protected function getInvoice($context)
69 69
 	{
70
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
70
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
71 71
 
72 72
 		$search = $manager->createSearch();
73
-		$search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) );
73
+		$search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56'));
74 74
 
75
-		$items = $manager->searchItems( $search );
75
+		$items = $manager->searchItems($search);
76 76
 
77
-		if( ( $item = reset( $items ) ) !== false ) {
77
+		if (($item = reset($items)) !== false) {
78 78
 			return $item;
79 79
 		}
80 80
 
81
-		throw new \Exception( 'No order item found' );
81
+		throw new \Exception('No order item found');
82 82
 	}
83 83
 }
Please login to merge, or discard this patch.
common/src/Controller/Common/Order/Export/Csv/Processor/Coupon/Standard.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,17 +40,17 @@
 block discarded – undo
40 40
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items
41 41
 	 * @return array Two dimensional associative list of order data representing the lines in CSV
42 42
 	 */
43
-	public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order )
43
+	public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order)
44 44
 	{
45 45
 		$result = [];
46 46
 
47
-		foreach( $order->getCoupons() as $code => $products )
47
+		foreach ($order->getCoupons() as $code => $products)
48 48
 		{
49 49
 			$data = [];
50 50
 
51
-			foreach( $this->getMapping() as $pos => $key )
51
+			foreach ($this->getMapping() as $pos => $key)
52 52
 			{
53
-				if( $key === 'order.base.coupon.code' ) {
53
+				if ($key === 'order.base.coupon.code') {
54 54
 					$data[$pos] = $code;
55 55
 				} else {
56 56
 					$data[$pos] = '';
Please login to merge, or discard this patch.