@@ -18,18 +18,18 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function setUp() |
| 20 | 20 | { |
| 21 | - \Aimeos\MShop::cache( true ); |
|
| 21 | + \Aimeos\MShop::cache(true); |
|
| 22 | 22 | |
| 23 | 23 | $this->context = \TestHelperJobs::getContext(); |
| 24 | 24 | $this->aimeos = \TestHelperJobs::getAimeos(); |
| 25 | 25 | |
| 26 | - $this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard( $this->context, $this->aimeos ); |
|
| 26 | + $this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard($this->context, $this->aimeos); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | protected function tearDown() |
| 31 | 31 | { |
| 32 | - \Aimeos\MShop::cache( false ); |
|
| 32 | + \Aimeos\MShop::cache(false); |
|
| 33 | 33 | \Aimeos\MShop::clear(); |
| 34 | 34 | |
| 35 | 35 | $this->object = null; |
@@ -38,34 +38,34 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function testGetName() |
| 40 | 40 | { |
| 41 | - $this->assertEquals( 'Product export', $this->object->getName() ); |
|
| 41 | + $this->assertEquals('Product export', $this->object->getName()); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testGetDescription() |
| 46 | 46 | { |
| 47 | 47 | $text = 'Exports all available products'; |
| 48 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
| 48 | + $this->assertEquals($text, $this->object->getDescription()); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testRun() |
| 53 | 53 | { |
| 54 | - $this->context->getConfig()->set( 'controller/jobs/product/export/filename', 'aimeos-products-%1$d.xml' ); |
|
| 54 | + $this->context->getConfig()->set('controller/jobs/product/export/filename', 'aimeos-products-%1$d.xml'); |
|
| 55 | 55 | |
| 56 | 56 | $this->object->run(); |
| 57 | 57 | |
| 58 | 58 | $ds = DIRECTORY_SEPARATOR; |
| 59 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-products-1.xml' ); |
|
| 60 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-products-2.xml' ); |
|
| 59 | + $this->assertFileExists('tmp' . $ds . 'aimeos-products-1.xml'); |
|
| 60 | + $this->assertFileExists('tmp' . $ds . 'aimeos-products-2.xml'); |
|
| 61 | 61 | |
| 62 | - $file1 = file_get_contents( 'tmp' . $ds . 'aimeos-products-1.xml' ); |
|
| 63 | - $file2 = file_get_contents( 'tmp' . $ds . 'aimeos-products-2.xml' ); |
|
| 62 | + $file1 = file_get_contents('tmp' . $ds . 'aimeos-products-1.xml'); |
|
| 63 | + $file2 = file_get_contents('tmp' . $ds . 'aimeos-products-2.xml'); |
|
| 64 | 64 | |
| 65 | - unlink( 'tmp' . $ds . 'aimeos-products-1.xml' ); |
|
| 66 | - unlink( 'tmp' . $ds . 'aimeos-products-2.xml' ); |
|
| 65 | + unlink('tmp' . $ds . 'aimeos-products-1.xml'); |
|
| 66 | + unlink('tmp' . $ds . 'aimeos-products-2.xml'); |
|
| 67 | 67 | |
| 68 | - $this->assertContains( 'CNE', $file2 ); |
|
| 69 | - $this->assertContains( 'U:BUNDLE', $file2 ); |
|
| 68 | + $this->assertContains('CNE', $file2); |
|
| 69 | + $this->assertContains('U:BUNDLE', $file2); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | \ No newline at end of file |
@@ -18,18 +18,18 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function setUp() |
| 20 | 20 | { |
| 21 | - \Aimeos\MShop::cache( true ); |
|
| 21 | + \Aimeos\MShop::cache(true); |
|
| 22 | 22 | |
| 23 | 23 | $this->context = \TestHelperJobs::getContext(); |
| 24 | 24 | $this->aimeos = \TestHelperJobs::getAimeos(); |
| 25 | 25 | |
| 26 | - $this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard( $this->context, $this->aimeos ); |
|
| 26 | + $this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard($this->context, $this->aimeos); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | protected function tearDown() |
| 31 | 31 | { |
| 32 | - \Aimeos\MShop::cache( false ); |
|
| 32 | + \Aimeos\MShop::cache(false); |
|
| 33 | 33 | \Aimeos\MShop::clear(); |
| 34 | 34 | |
| 35 | 35 | $this->object = null; |
@@ -38,40 +38,40 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function testGetName() |
| 40 | 40 | { |
| 41 | - $this->assertEquals( 'Product site map', $this->object->getName() ); |
|
| 41 | + $this->assertEquals('Product site map', $this->object->getName()); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testGetDescription() |
| 46 | 46 | { |
| 47 | 47 | $text = 'Creates a product site map for search engines'; |
| 48 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
| 48 | + $this->assertEquals($text, $this->object->getDescription()); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testRun() |
| 53 | 53 | { |
| 54 | - $this->context->getConfig()->set( 'controller/jobs/product/export/sitemap/max-items', 5 ); |
|
| 54 | + $this->context->getConfig()->set('controller/jobs/product/export/sitemap/max-items', 5); |
|
| 55 | 55 | |
| 56 | 56 | $this->object->run(); |
| 57 | 57 | |
| 58 | 58 | $ds = DIRECTORY_SEPARATOR; |
| 59 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' ); |
|
| 60 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' ); |
|
| 61 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' ); |
|
| 59 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-1.xml.gz'); |
|
| 60 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-2.xml.gz'); |
|
| 61 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-index.xml.gz'); |
|
| 62 | 62 | |
| 63 | - $file1 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb' ), 0x1000 ); |
|
| 64 | - $file2 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb' ), 0x1000 ); |
|
| 65 | - $index = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb' ), 0x1000 ); |
|
| 63 | + $file1 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb'), 0x1000); |
|
| 64 | + $file2 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb'), 0x1000); |
|
| 65 | + $index = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb'), 0x1000); |
|
| 66 | 66 | |
| 67 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' ); |
|
| 68 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' ); |
|
| 69 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' ); |
|
| 67 | + unlink('tmp' . $ds . 'aimeos-sitemap-1.xml.gz'); |
|
| 68 | + unlink('tmp' . $ds . 'aimeos-sitemap-2.xml.gz'); |
|
| 69 | + unlink('tmp' . $ds . 'aimeos-sitemap-index.xml.gz'); |
|
| 70 | 70 | |
| 71 | - $this->assertContains( 'Cafe_Noire_Expresso', $file2 ); |
|
| 72 | - $this->assertContains( 'Unittest%3A_Bundle', $file2 ); |
|
| 71 | + $this->assertContains('Cafe_Noire_Expresso', $file2); |
|
| 72 | + $this->assertContains('Unittest%3A_Bundle', $file2); |
|
| 73 | 73 | |
| 74 | - $this->assertContains( 'aimeos-sitemap-1.xml.gz', $index ); |
|
| 75 | - $this->assertContains( 'aimeos-sitemap-2.xml.gz', $index ); |
|
| 74 | + $this->assertContains('aimeos-sitemap-1.xml.gz', $index); |
|
| 75 | + $this->assertContains('aimeos-sitemap-2.xml.gz', $index); |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | \ No newline at end of file |
@@ -19,18 +19,18 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected function setUp() |
| 21 | 21 | { |
| 22 | - \Aimeos\MShop::cache( true ); |
|
| 22 | + \Aimeos\MShop::cache(true); |
|
| 23 | 23 | |
| 24 | 24 | $this->context = \TestHelperJobs::getContext(); |
| 25 | 25 | $this->aimeos = \TestHelperJobs::getAimeos(); |
| 26 | 26 | |
| 27 | - $this->object = new \Aimeos\Controller\Jobs\Product\Bought\Standard( $this->context, $this->aimeos ); |
|
| 27 | + $this->object = new \Aimeos\Controller\Jobs\Product\Bought\Standard($this->context, $this->aimeos); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | protected function tearDown() |
| 32 | 32 | { |
| 33 | - \Aimeos\MShop::cache( false ); |
|
| 33 | + \Aimeos\MShop::cache(false); |
|
| 34 | 34 | \Aimeos\MShop::clear(); |
| 35 | 35 | |
| 36 | 36 | $this->object = null; |
@@ -39,28 +39,28 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public function testGetName() |
| 41 | 41 | { |
| 42 | - $this->assertEquals( 'Products bought together', $this->object->getName() ); |
|
| 42 | + $this->assertEquals('Products bought together', $this->object->getName()); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | public function testGetDescription() |
| 47 | 47 | { |
| 48 | 48 | $text = 'Creates bought together product suggestions'; |
| 49 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
| 49 | + $this->assertEquals($text, $this->object->getDescription()); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | public function testRun() |
| 54 | 54 | { |
| 55 | - $stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard' ) |
|
| 56 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 57 | - ->setMethods( array( 'deleteItems', 'saveItem' ) ) |
|
| 55 | + $stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard') |
|
| 56 | + ->setConstructorArgs(array($this->context)) |
|
| 57 | + ->setMethods(array('deleteItems', 'saveItem')) |
|
| 58 | 58 | ->getMock(); |
| 59 | 59 | |
| 60 | - \Aimeos\MShop::inject( $this->context, 'product/lists', $stub ); |
|
| 60 | + \Aimeos\MShop::inject($this->context, 'product/lists', $stub); |
|
| 61 | 61 | |
| 62 | - $stub->expects( $this->atLeastOnce() )->method( 'deleteItems' ); |
|
| 63 | - $stub->expects( $this->atLeastOnce() )->method( 'saveItem' ); |
|
| 62 | + $stub->expects($this->atLeastOnce())->method('deleteItems'); |
|
| 63 | + $stub->expects($this->atLeastOnce())->method('saveItem'); |
|
| 64 | 64 | |
| 65 | 65 | $this->object->run(); |
| 66 | 66 | } |
@@ -18,65 +18,65 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function setUp() |
| 20 | 20 | { |
| 21 | - \Aimeos\MShop::cache( true ); |
|
| 21 | + \Aimeos\MShop::cache(true); |
|
| 22 | 22 | |
| 23 | 23 | $this->context = \TestHelperJobs::getContext(); |
| 24 | 24 | $this->aimeos = \TestHelperJobs::getAimeos(); |
| 25 | 25 | $config = $this->context->getConfig(); |
| 26 | 26 | |
| 27 | - $config->set( 'controller/jobs/catalog/import/csv/skip-lines', 1 ); |
|
| 28 | - $config->set( 'controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/valid' ); |
|
| 27 | + $config->set('controller/jobs/catalog/import/csv/skip-lines', 1); |
|
| 28 | + $config->set('controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/valid'); |
|
| 29 | 29 | |
| 30 | - $this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard( $this->context, $this->aimeos ); |
|
| 30 | + $this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard($this->context, $this->aimeos); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | protected function tearDown() |
| 35 | 35 | { |
| 36 | - \Aimeos\MShop::cache( false ); |
|
| 36 | + \Aimeos\MShop::cache(false); |
|
| 37 | 37 | \Aimeos\MShop::clear(); |
| 38 | 38 | |
| 39 | 39 | $this->object = null; |
| 40 | 40 | |
| 41 | - if( file_exists( 'tmp/import.zip' ) ) { |
|
| 42 | - unlink( 'tmp/import.zip' ); |
|
| 41 | + if (file_exists('tmp/import.zip')) { |
|
| 42 | + unlink('tmp/import.zip'); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | public function testGetName() |
| 48 | 48 | { |
| 49 | - $this->assertEquals( 'Catalog import CSV', $this->object->getName() ); |
|
| 49 | + $this->assertEquals('Catalog import CSV', $this->object->getName()); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | public function testGetDescription() |
| 54 | 54 | { |
| 55 | 55 | $text = 'Imports new and updates existing categories from CSV files'; |
| 56 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
| 56 | + $this->assertEquals($text, $this->object->getDescription()); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | public function testRun() |
| 61 | 61 | { |
| 62 | - $catcodes = array( 'job_csv_test', 'job_csv_test2', 'job_csv_test3', 'job_csv_test4' ); |
|
| 63 | - $domains = array( 'media', 'text' ); |
|
| 62 | + $catcodes = array('job_csv_test', 'job_csv_test2', 'job_csv_test3', 'job_csv_test4'); |
|
| 63 | + $domains = array('media', 'text'); |
|
| 64 | 64 | |
| 65 | 65 | $convert = array( |
| 66 | 66 | 1 => 'Text/LatinUTF8', |
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | - $this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/converter', $convert ); |
|
| 69 | + $this->context->getConfig()->set('controller/jobs/catalog/import/csv/converter', $convert); |
|
| 70 | 70 | |
| 71 | 71 | $this->object->run(); |
| 72 | 72 | |
| 73 | - $tree = $this->get( 'job_csv_test', $domains ); |
|
| 74 | - $this->delete( $tree, $domains ); |
|
| 73 | + $tree = $this->get('job_csv_test', $domains); |
|
| 74 | + $this->delete($tree, $domains); |
|
| 75 | 75 | |
| 76 | - $this->assertEquals( 2, count( $tree->getListItems() ) ); |
|
| 76 | + $this->assertEquals(2, count($tree->getListItems())); |
|
| 77 | 77 | |
| 78 | - foreach( $tree->getChildren() as $node ) { |
|
| 79 | - $this->assertEquals( 2, count( $node->getListItems() ) ); |
|
| 78 | + foreach ($tree->getChildren() as $node) { |
|
| 79 | + $this->assertEquals(2, count($node->getListItems())); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | $this->object->run(); |
| 87 | 87 | $this->object->run(); |
| 88 | 88 | |
| 89 | - $tree = $this->get( 'job_csv_test', ['media', 'text'] ); |
|
| 90 | - $this->delete( $tree, ['media', 'text'] ); |
|
| 89 | + $tree = $this->get('job_csv_test', ['media', 'text']); |
|
| 90 | + $this->delete($tree, ['media', 'text']); |
|
| 91 | 91 | |
| 92 | - $this->assertEquals( 2, count( $tree->getListItems() ) ); |
|
| 92 | + $this->assertEquals(2, count($tree->getListItems())); |
|
| 93 | 93 | |
| 94 | - foreach( $tree->getChildren() as $node ) { |
|
| 95 | - $this->assertEquals( 2, count( $node->getListItems() ) ); |
|
| 94 | + foreach ($tree->getChildren() as $node) { |
|
| 95 | + $this->assertEquals(2, count($node->getListItems())); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -100,18 +100,18 @@ discard block |
||
| 100 | 100 | public function testRunPosition() |
| 101 | 101 | { |
| 102 | 102 | $config = $this->context->getConfig(); |
| 103 | - $mapping = $config->set( 'controller/jobs/catalog/import/csv/mapping', [] ); |
|
| 104 | - $mapping['item'] = array( 0 => 'catalog.label', 1 => 'catalog.code', 2 => 'catalog.parent' ); |
|
| 103 | + $mapping = $config->set('controller/jobs/catalog/import/csv/mapping', []); |
|
| 104 | + $mapping['item'] = array(0 => 'catalog.label', 1 => 'catalog.code', 2 => 'catalog.parent'); |
|
| 105 | 105 | |
| 106 | - $config->set( 'controller/jobs/catalog/import/csv/mapping', $mapping ); |
|
| 107 | - $config->set( 'controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/position' ); |
|
| 106 | + $config->set('controller/jobs/catalog/import/csv/mapping', $mapping); |
|
| 107 | + $config->set('controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/position'); |
|
| 108 | 108 | |
| 109 | 109 | $this->object->run(); |
| 110 | 110 | |
| 111 | - $tree = $this->get( 'job_csv_test' ); |
|
| 112 | - $this->delete( $tree ); |
|
| 111 | + $tree = $this->get('job_csv_test'); |
|
| 112 | + $this->delete($tree); |
|
| 113 | 113 | |
| 114 | - $this->assertEquals( 1, count( $tree->getChildren() ) ); |
|
| 114 | + $this->assertEquals(1, count($tree->getChildren())); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
@@ -135,12 +135,12 @@ discard block |
||
| 135 | 135 | ), |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | - $this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/mapping', $mapping ); |
|
| 138 | + $this->context->getConfig()->set('controller/jobs/catalog/import/csv/mapping', $mapping); |
|
| 139 | 139 | |
| 140 | 140 | $this->object->run(); |
| 141 | 141 | |
| 142 | - $tree = $this->get( 'job_csv_test' ); |
|
| 143 | - $this->delete( $tree ); |
|
| 142 | + $tree = $this->get('job_csv_test'); |
|
| 143 | + $this->delete($tree); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | ), |
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | - $this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/mapping', $mapping ); |
|
| 155 | + $this->context->getConfig()->set('controller/jobs/catalog/import/csv/mapping', $mapping); |
|
| 156 | 156 | |
| 157 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 157 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 158 | 158 | $this->object->run(); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | ), |
| 179 | 179 | ); |
| 180 | 180 | |
| 181 | - $this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/mapping', $mapping ); |
|
| 181 | + $this->context->getConfig()->set('controller/jobs/catalog/import/csv/mapping', $mapping); |
|
| 182 | 182 | |
| 183 | 183 | $config = $this->context->getConfig(); |
| 184 | - $config->set( 'controller/jobs/catalog/import/csv/skip-lines', 0 ); |
|
| 185 | - $config->set( 'controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/invalid' ); |
|
| 184 | + $config->set('controller/jobs/catalog/import/csv/skip-lines', 0); |
|
| 185 | + $config->set('controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/invalid'); |
|
| 186 | 186 | |
| 187 | - $this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard( $this->context, $this->aimeos ); |
|
| 187 | + $this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard($this->context, $this->aimeos); |
|
| 188 | 188 | |
| 189 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 189 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 190 | 190 | $this->object->run(); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -194,65 +194,65 @@ discard block |
||
| 194 | 194 | public function testRunBackup() |
| 195 | 195 | { |
| 196 | 196 | $config = $this->context->getConfig(); |
| 197 | - $config->set( 'controller/jobs/catalog/import/csv/container/type', 'Zip' ); |
|
| 198 | - $config->set( 'controller/jobs/catalog/import/csv/location', 'tmp/import.zip' ); |
|
| 199 | - $config->set( 'controller/jobs/catalog/import/csv/backup', 'tmp/test-%Y-%m-%d.zip' ); |
|
| 197 | + $config->set('controller/jobs/catalog/import/csv/container/type', 'Zip'); |
|
| 198 | + $config->set('controller/jobs/catalog/import/csv/location', 'tmp/import.zip'); |
|
| 199 | + $config->set('controller/jobs/catalog/import/csv/backup', 'tmp/test-%Y-%m-%d.zip'); |
|
| 200 | 200 | |
| 201 | - if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) { |
|
| 202 | - throw new \RuntimeException( 'Unable to copy test file' ); |
|
| 201 | + if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) { |
|
| 202 | + throw new \RuntimeException('Unable to copy test file'); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $this->object->run(); |
| 206 | 206 | |
| 207 | - $filename = strftime( 'tmp/test-%Y-%m-%d.zip' ); |
|
| 208 | - $this->assertTrue( file_exists( $filename ) ); |
|
| 207 | + $filename = strftime('tmp/test-%Y-%m-%d.zip'); |
|
| 208 | + $this->assertTrue(file_exists($filename)); |
|
| 209 | 209 | |
| 210 | - unlink( $filename ); |
|
| 210 | + unlink($filename); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | public function testRunBackupInvalid() |
| 215 | 215 | { |
| 216 | 216 | $config = $this->context->getConfig(); |
| 217 | - $config->set( 'controller/jobs/catalog/import/csv/container/type', 'Zip' ); |
|
| 218 | - $config->set( 'controller/jobs/catalog/import/csv/location', 'tmp/import.zip' ); |
|
| 219 | - $config->set( 'controller/jobs/catalog/import/csv/backup', 'tmp/notexist/import.zip' ); |
|
| 217 | + $config->set('controller/jobs/catalog/import/csv/container/type', 'Zip'); |
|
| 218 | + $config->set('controller/jobs/catalog/import/csv/location', 'tmp/import.zip'); |
|
| 219 | + $config->set('controller/jobs/catalog/import/csv/backup', 'tmp/notexist/import.zip'); |
|
| 220 | 220 | |
| 221 | - if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) { |
|
| 222 | - throw new \RuntimeException( 'Unable to copy test file' ); |
|
| 221 | + if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) { |
|
| 222 | + throw new \RuntimeException('Unable to copy test file'); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 225 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 226 | 226 | $this->object->run(); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | |
| 230 | - protected function delete( \Aimeos\MShop\Catalog\Item\Iface $tree, array $domains = [] ) |
|
| 230 | + protected function delete(\Aimeos\MShop\Catalog\Item\Iface $tree, array $domains = []) |
|
| 231 | 231 | { |
| 232 | - $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
| 232 | + $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
| 233 | 233 | |
| 234 | - foreach( $domains as $domain ) |
|
| 234 | + foreach ($domains as $domain) |
|
| 235 | 235 | { |
| 236 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, $domain ); |
|
| 236 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, $domain); |
|
| 237 | 237 | |
| 238 | - foreach( $tree->getListItems( $domain ) as $listItem ) { |
|
| 239 | - $manager->deleteItem( $listItem->getRefItem()->getId() ); |
|
| 238 | + foreach ($tree->getListItems($domain) as $listItem) { |
|
| 239 | + $manager->deleteItem($listItem->getRefItem()->getId()); |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - foreach( $tree->getChildren() as $node ) { |
|
| 244 | - $this->delete( $node, $domains ); |
|
| 243 | + foreach ($tree->getChildren() as $node) { |
|
| 244 | + $this->delete($node, $domains); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - $catalogManager->deleteItem( $tree->getId() ); |
|
| 247 | + $catalogManager->deleteItem($tree->getId()); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
| 251 | - protected function get( $catcode, array $domains = [] ) |
|
| 251 | + protected function get($catcode, array $domains = []) |
|
| 252 | 252 | { |
| 253 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
| 254 | - $root = $manager->findItem( $catcode ); |
|
| 253 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
| 254 | + $root = $manager->findItem($catcode); |
|
| 255 | 255 | |
| 256 | - return $manager->getTree( $root->getId(), $domains, \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE ); |
|
| 256 | + return $manager->getTree($root->getId(), $domains, \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE); |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | \ No newline at end of file |
@@ -18,95 +18,95 @@ |
||
| 18 | 18 | |
| 19 | 19 | protected function setUp() |
| 20 | 20 | { |
| 21 | - \Aimeos\MShop::cache( true ); |
|
| 21 | + \Aimeos\MShop::cache(true); |
|
| 22 | 22 | |
| 23 | 23 | $this->context = \TestHelperJobs::getContext(); |
| 24 | 24 | $this->aimeos = \TestHelperJobs::getAimeos(); |
| 25 | 25 | $config = $this->context->getConfig(); |
| 26 | 26 | |
| 27 | - $config->set( 'controller/jobs/product/import/csv/skip-lines', 1 ); |
|
| 27 | + $config->set('controller/jobs/product/import/csv/skip-lines', 1); |
|
| 28 | 28 | |
| 29 | - $this->object = new \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Standard( $this->context, $this->aimeos ); |
|
| 29 | + $this->object = new \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Standard($this->context, $this->aimeos); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | protected function tearDown() |
| 34 | 34 | { |
| 35 | - \Aimeos\MShop::cache( false ); |
|
| 35 | + \Aimeos\MShop::cache(false); |
|
| 36 | 36 | \Aimeos\MShop::clear(); |
| 37 | 37 | |
| 38 | - unset( $this->object ); |
|
| 38 | + unset($this->object); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | public function testGetName() |
| 43 | 43 | { |
| 44 | - $this->assertEquals( 'Coupon code import CSV', $this->object->getName() ); |
|
| 44 | + $this->assertEquals('Coupon code import CSV', $this->object->getName()); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | public function testGetDescription() |
| 49 | 49 | { |
| 50 | 50 | $text = 'Imports new and updates existing coupon code from CSV files'; |
| 51 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
| 51 | + $this->assertEquals($text, $this->object->getDescription()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | public function testRun() |
| 56 | 56 | { |
| 57 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'coupon' ); |
|
| 58 | - $coupon = $manager->saveItem( $manager->createItem()->setProvider( 'Example' ) ); |
|
| 57 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'coupon'); |
|
| 58 | + $coupon = $manager->saveItem($manager->createItem()->setProvider('Example')); |
|
| 59 | 59 | |
| 60 | 60 | $dir = 'tmp/import/couponcode/unittest'; |
| 61 | 61 | $filepath = $dir . '/' . $coupon->getId() . '.csv'; |
| 62 | 62 | |
| 63 | - if( !is_dir( $dir ) && mkdir( 'tmp/import/couponcode/unittest', 0775, true ) === false ) { |
|
| 64 | - throw new \Exception( sprintf( 'Unable to create directory "%1$s"', $dir ) ); |
|
| 63 | + if (!is_dir($dir) && mkdir('tmp/import/couponcode/unittest', 0775, true) === false) { |
|
| 64 | + throw new \Exception(sprintf('Unable to create directory "%1$s"', $dir)); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $content = 'code,count,start,end |
| 68 | 68 | jobccimport1,3,2000-01-01 00:00:00, |
| 69 | 69 | jobccimport2,5,,'; |
| 70 | 70 | |
| 71 | - if( file_put_contents( $filepath, $content ) === false ) { |
|
| 72 | - throw new \Exception( sprintf( 'Unable to create file "%1$s"', $file ) ); |
|
| 71 | + if (file_put_contents($filepath, $content) === false) { |
|
| 72 | + throw new \Exception(sprintf('Unable to create file "%1$s"', $file)); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $this->object->run(); |
| 76 | 76 | |
| 77 | 77 | |
| 78 | - $codeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'coupon/code' ); |
|
| 79 | - $code1 = $codeManager->findItem( 'jobccimport1' ); |
|
| 80 | - $code2 = $codeManager->findItem( 'jobccimport2' ); |
|
| 78 | + $codeManager = \Aimeos\MShop\Factory::createManager($this->context, 'coupon/code'); |
|
| 79 | + $code1 = $codeManager->findItem('jobccimport1'); |
|
| 80 | + $code2 = $codeManager->findItem('jobccimport2'); |
|
| 81 | 81 | |
| 82 | - $manager->deleteItem( $coupon->getId() ); |
|
| 82 | + $manager->deleteItem($coupon->getId()); |
|
| 83 | 83 | |
| 84 | - $this->assertEquals( 3, $code1->getCount() ); |
|
| 85 | - $this->assertEquals( '2000-01-01 00:00:00', $code1->getDateStart() ); |
|
| 86 | - $this->assertEquals( null, $code1->getDateEnd() ); |
|
| 84 | + $this->assertEquals(3, $code1->getCount()); |
|
| 85 | + $this->assertEquals('2000-01-01 00:00:00', $code1->getDateStart()); |
|
| 86 | + $this->assertEquals(null, $code1->getDateEnd()); |
|
| 87 | 87 | |
| 88 | - $this->assertEquals( 5, $code2->getCount() ); |
|
| 89 | - $this->assertEquals( null, $code2->getDateStart() ); |
|
| 90 | - $this->assertEquals( null, $code2->getDateEnd() ); |
|
| 88 | + $this->assertEquals(5, $code2->getCount()); |
|
| 89 | + $this->assertEquals(null, $code2->getDateStart()); |
|
| 90 | + $this->assertEquals(null, $code2->getDateEnd()); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | public function testRunException() |
| 95 | 95 | { |
| 96 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'coupon' ); |
|
| 96 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'coupon'); |
|
| 97 | 97 | |
| 98 | 98 | $dir = 'tmp/import/couponcode/unittest'; |
| 99 | 99 | $filepath = $dir . '/0.csv'; |
| 100 | 100 | |
| 101 | - if( !is_dir( $dir ) && mkdir( 'tmp/import/couponcode/unittest', 0775, true ) === false ) { |
|
| 102 | - throw new \Exception( sprintf( 'Unable to create directory "%1$s"', $dir ) ); |
|
| 101 | + if (!is_dir($dir) && mkdir('tmp/import/couponcode/unittest', 0775, true) === false) { |
|
| 102 | + throw new \Exception(sprintf('Unable to create directory "%1$s"', $dir)); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $content = 'code,count,start,end |
| 106 | 106 | jobccimport1,,,'; |
| 107 | 107 | |
| 108 | - if( file_put_contents( $filepath, $content ) === false ) { |
|
| 109 | - throw new \Exception( sprintf( 'Unable to create file "%1$s"', $file ) ); |
|
| 108 | + if (file_put_contents($filepath, $content) === false) { |
|
| 109 | + throw new \Exception(sprintf('Unable to create file "%1$s"', $file)); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $this->object->run(); |
@@ -20,49 +20,49 @@ discard block |
||
| 20 | 20 | $aimeos = \TestHelperJobs::getAimeos(); |
| 21 | 21 | $this->context = \TestHelperJobs::getContext(); |
| 22 | 22 | |
| 23 | - $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard( $this->context, $aimeos ); |
|
| 23 | + $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard($this->context, $aimeos); |
|
| 24 | 24 | |
| 25 | - \Aimeos\MShop::cache( true ); |
|
| 25 | + \Aimeos\MShop::cache(true); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | protected function tearDown() |
| 30 | 30 | { |
| 31 | - \Aimeos\MShop::cache( false ); |
|
| 31 | + \Aimeos\MShop::cache(false); |
|
| 32 | 32 | \Aimeos\MShop::clear(); |
| 33 | 33 | |
| 34 | - unset( $this->object, $this->context ); |
|
| 34 | + unset($this->object, $this->context); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public function testGetName() |
| 39 | 39 | { |
| 40 | - $this->assertEquals( 'Subscription process start', $this->object->getName() ); |
|
| 40 | + $this->assertEquals('Subscription process start', $this->object->getName()); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testGetDescription() |
| 45 | 45 | { |
| 46 | - $this->assertEquals( 'Process subscriptions initially', $this->object->getDescription() ); |
|
| 46 | + $this->assertEquals('Process subscriptions initially', $this->object->getDescription()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testRun() |
| 51 | 51 | { |
| 52 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
| 52 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
| 53 | 53 | $item = $this->getSubscription(); |
| 54 | 54 | |
| 55 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
| 56 | - ->setConstructorArgs( [$this->context] ) |
|
| 57 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
| 55 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
| 56 | + ->setConstructorArgs([$this->context]) |
|
| 57 | + ->setMethods(['searchItems', 'saveItem']) |
|
| 58 | 58 | ->getMock(); |
| 59 | 59 | |
| 60 | - \Aimeos\MShop::inject( $this->context, 'subscription', $managerStub ); |
|
| 60 | + \Aimeos\MShop::inject($this->context, 'subscription', $managerStub); |
|
| 61 | 61 | |
| 62 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
| 63 | - ->will( $this->returnValue( [$item] ) ); |
|
| 62 | + $managerStub->expects($this->once())->method('searchItems') |
|
| 63 | + ->will($this->returnValue([$item])); |
|
| 64 | 64 | |
| 65 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 65 | + $managerStub->expects($this->once())->method('saveItem'); |
|
| 66 | 66 | |
| 67 | 67 | $this->object->run(); |
| 68 | 68 | } |
@@ -70,21 +70,21 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function testRunException() |
| 72 | 72 | { |
| 73 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
| 74 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1'] ); |
|
| 73 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
| 74 | + $this->context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1']); |
|
| 75 | 75 | |
| 76 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
| 77 | - ->setConstructorArgs( [$this->context] ) |
|
| 78 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
| 76 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
| 77 | + ->setConstructorArgs([$this->context]) |
|
| 78 | + ->setMethods(['searchItems', 'saveItem']) |
|
| 79 | 79 | ->getMock(); |
| 80 | 80 | |
| 81 | - \Aimeos\MShop::inject( $this->context, 'subscription', $managerStub ); |
|
| 81 | + \Aimeos\MShop::inject($this->context, 'subscription', $managerStub); |
|
| 82 | 82 | |
| 83 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
| 84 | - ->will( $this->returnValue( [$managerStub->createItem()] ) ); |
|
| 83 | + $managerStub->expects($this->once())->method('searchItems') |
|
| 84 | + ->will($this->returnValue([$managerStub->createItem()])); |
|
| 85 | 85 | |
| 86 | - $managerStub->expects( $this->once() )->method( 'saveItem' ) |
|
| 87 | - ->will( $this->throwException( new \Exception() ) ); |
|
| 86 | + $managerStub->expects($this->once())->method('saveItem') |
|
| 87 | + ->will($this->throwException(new \Exception())); |
|
| 88 | 88 | |
| 89 | 89 | $this->object->run(); |
| 90 | 90 | } |
@@ -92,17 +92,17 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | protected function getSubscription() |
| 94 | 94 | { |
| 95 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' ); |
|
| 95 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription'); |
|
| 96 | 96 | |
| 97 | 97 | $search = $manager->createSearch(); |
| 98 | - $search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
|
| 98 | + $search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01')); |
|
| 99 | 99 | |
| 100 | - $items = $manager->searchItems( $search ); |
|
| 100 | + $items = $manager->searchItems($search); |
|
| 101 | 101 | |
| 102 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 102 | + if (($item = reset($items)) !== false) { |
|
| 103 | 103 | return $item; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - throw new \Exception( 'No subscription item found' ); |
|
| 106 | + throw new \Exception('No subscription item found'); |
|
| 107 | 107 | } |
| 108 | 108 | } |
@@ -21,62 +21,62 @@ discard block |
||
| 21 | 21 | $this->aimeos = \TestHelperJobs::getAimeos(); |
| 22 | 22 | $this->context = \TestHelperJobs::getContext(); |
| 23 | 23 | |
| 24 | - $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard( $this->context, $this->aimeos ); |
|
| 24 | + $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard($this->context, $this->aimeos); |
|
| 25 | 25 | |
| 26 | - \Aimeos\MShop::cache( true ); |
|
| 26 | + \Aimeos\MShop::cache(true); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | protected function tearDown() |
| 31 | 31 | { |
| 32 | - \Aimeos\MShop::cache( false ); |
|
| 32 | + \Aimeos\MShop::cache(false); |
|
| 33 | 33 | \Aimeos\MShop::clear(); |
| 34 | 34 | |
| 35 | - unset( $this->object, $this->context, $this->aimeos ); |
|
| 35 | + unset($this->object, $this->context, $this->aimeos); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | public function testGetName() |
| 40 | 40 | { |
| 41 | - $this->assertEquals( 'Subscription process renew', $this->object->getName() ); |
|
| 41 | + $this->assertEquals('Subscription process renew', $this->object->getName()); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testGetDescription() |
| 46 | 46 | { |
| 47 | - $this->assertEquals( 'Renews subscriptions at next date', $this->object->getDescription() ); |
|
| 47 | + $this->assertEquals('Renews subscriptions at next date', $this->object->getDescription()); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | public function testRun() |
| 52 | 52 | { |
| 53 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
| 53 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
| 54 | 54 | $item = $this->getSubscription(); |
| 55 | 55 | |
| 56 | - $object = $this->getMockBuilder( '\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard' ) |
|
| 57 | - ->setConstructorArgs( [$this->context, $this->aimeos] ) |
|
| 58 | - ->setMethods( ['createOrderBase', 'createOrderInvoice', 'createPayment'] ) |
|
| 56 | + $object = $this->getMockBuilder('\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard') |
|
| 57 | + ->setConstructorArgs([$this->context, $this->aimeos]) |
|
| 58 | + ->setMethods(['createOrderBase', 'createOrderInvoice', 'createPayment']) |
|
| 59 | 59 | ->getMock(); |
| 60 | 60 | |
| 61 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
| 62 | - ->setConstructorArgs( [$this->context] ) |
|
| 63 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
| 61 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
| 62 | + ->setConstructorArgs([$this->context]) |
|
| 63 | + ->setMethods(['searchItems', 'saveItem']) |
|
| 64 | 64 | ->getMock(); |
| 65 | 65 | |
| 66 | - \Aimeos\MShop::inject( $this->context, 'subscription', $managerStub ); |
|
| 66 | + \Aimeos\MShop::inject($this->context, 'subscription', $managerStub); |
|
| 67 | 67 | |
| 68 | - $object->expects( $this->once() )->method( 'createOrderBase' ) |
|
| 69 | - ->will( $this->returnValue( $this->getOrderBaseItem( $item->getOrderBaseId() ) ) ); |
|
| 68 | + $object->expects($this->once())->method('createOrderBase') |
|
| 69 | + ->will($this->returnValue($this->getOrderBaseItem($item->getOrderBaseId()))); |
|
| 70 | 70 | |
| 71 | - $object->expects( $this->once() )->method( 'createOrderInvoice' ) |
|
| 72 | - ->will( $this->returnValue( $this->getOrderItem() ) ); |
|
| 71 | + $object->expects($this->once())->method('createOrderInvoice') |
|
| 72 | + ->will($this->returnValue($this->getOrderItem())); |
|
| 73 | 73 | |
| 74 | - $object->expects( $this->once() )->method( 'createPayment' ); |
|
| 74 | + $object->expects($this->once())->method('createPayment'); |
|
| 75 | 75 | |
| 76 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
| 77 | - ->will( $this->returnValue( [$item] ) ); |
|
| 76 | + $managerStub->expects($this->once())->method('searchItems') |
|
| 77 | + ->will($this->returnValue([$item])); |
|
| 78 | 78 | |
| 79 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 79 | + $managerStub->expects($this->once())->method('saveItem'); |
|
| 80 | 80 | |
| 81 | 81 | $object->run(); |
| 82 | 82 | } |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function testRunException() |
| 86 | 86 | { |
| 87 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
| 87 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
| 88 | 88 | |
| 89 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
| 90 | - ->setConstructorArgs( [$this->context] ) |
|
| 91 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
| 89 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
| 90 | + ->setConstructorArgs([$this->context]) |
|
| 91 | + ->setMethods(['searchItems', 'saveItem']) |
|
| 92 | 92 | ->getMock(); |
| 93 | 93 | |
| 94 | - \Aimeos\MShop::inject( $this->context, 'subscription', $managerStub ); |
|
| 94 | + \Aimeos\MShop::inject($this->context, 'subscription', $managerStub); |
|
| 95 | 95 | |
| 96 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
| 97 | - ->will( $this->returnValue( [$managerStub->createItem()] ) ); |
|
| 96 | + $managerStub->expects($this->once())->method('searchItems') |
|
| 97 | + ->will($this->returnValue([$managerStub->createItem()])); |
|
| 98 | 98 | |
| 99 | - $managerStub->expects( $this->never() )->method( 'saveItem' ); |
|
| 99 | + $managerStub->expects($this->never())->method('saveItem'); |
|
| 100 | 100 | |
| 101 | 101 | $this->object->run(); |
| 102 | 102 | } |
@@ -104,79 +104,79 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function testAddBasketAddresses() |
| 106 | 106 | { |
| 107 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 108 | - $address = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/address' )->createItem(); |
|
| 107 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 108 | + $address = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/address')->createItem(); |
|
| 109 | 109 | |
| 110 | 110 | $addresses = ['payment' => $address]; |
| 111 | - $basket = $this->access( 'addBasketAddresses' )->invokeArgs( $this->object, [$this->context, $basket, $addresses] ); |
|
| 111 | + $basket = $this->access('addBasketAddresses')->invokeArgs($this->object, [$this->context, $basket, $addresses]); |
|
| 112 | 112 | |
| 113 | - $this->assertEquals( 1, count( $basket->getAddresses() ) ); |
|
| 114 | - $this->assertInstanceOf( \Aimeos\MShop\Order\Item\Base\Address\Iface::class, $basket->getAddress( 'payment' ) ); |
|
| 113 | + $this->assertEquals(1, count($basket->getAddresses())); |
|
| 114 | + $this->assertInstanceOf(\Aimeos\MShop\Order\Item\Base\Address\Iface::class, $basket->getAddress('payment')); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | public function testAddBasketCoupons() |
| 119 | 119 | { |
| 120 | - $this->context->getConfig()->set( 'controller/jobs/subcription/process/renew/standard/use-coupons', true ); |
|
| 120 | + $this->context->getConfig()->set('controller/jobs/subcription/process/renew/standard/use-coupons', true); |
|
| 121 | 121 | |
| 122 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 123 | - $product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC', ['price'] ); |
|
| 124 | - $orderProduct = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' )->createItem(); |
|
| 122 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 123 | + $product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC', ['price']); |
|
| 124 | + $orderProduct = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product')->createItem(); |
|
| 125 | 125 | |
| 126 | - $price = $product->getRefItems( 'price', 'default', 'default' ); |
|
| 127 | - $basket->addProduct( $orderProduct->copyFrom( $product )->setPrice( reset( $price ) ) ); |
|
| 126 | + $price = $product->getRefItems('price', 'default', 'default'); |
|
| 127 | + $basket->addProduct($orderProduct->copyFrom($product)->setPrice(reset($price))); |
|
| 128 | 128 | |
| 129 | - $this->assertEquals( '600.00', $basket->getPrice()->getValue() ); |
|
| 130 | - $this->assertEquals( '30.00', $basket->getPrice()->getCosts() ); |
|
| 131 | - $this->assertEquals( '0.00', $basket->getPrice()->getRebate() ); |
|
| 129 | + $this->assertEquals('600.00', $basket->getPrice()->getValue()); |
|
| 130 | + $this->assertEquals('30.00', $basket->getPrice()->getCosts()); |
|
| 131 | + $this->assertEquals('0.00', $basket->getPrice()->getRebate()); |
|
| 132 | 132 | |
| 133 | - $basket = $this->access( 'addBasketCoupons' )->invokeArgs( $this->object, [$this->context, $basket, ['90AB']] ); |
|
| 133 | + $basket = $this->access('addBasketCoupons')->invokeArgs($this->object, [$this->context, $basket, ['90AB']]); |
|
| 134 | 134 | |
| 135 | - $this->assertEquals( 1, count( $basket->getCoupons() ) ); |
|
| 136 | - $this->assertEquals( 2, count( $basket->getProducts() ) ); |
|
| 137 | - $this->assertEquals( '537.00', $basket->getPrice()->getValue() ); |
|
| 138 | - $this->assertEquals( '30.00', $basket->getPrice()->getCosts() ); |
|
| 139 | - $this->assertEquals( '63.00', $basket->getPrice()->getRebate() ); |
|
| 135 | + $this->assertEquals(1, count($basket->getCoupons())); |
|
| 136 | + $this->assertEquals(2, count($basket->getProducts())); |
|
| 137 | + $this->assertEquals('537.00', $basket->getPrice()->getValue()); |
|
| 138 | + $this->assertEquals('30.00', $basket->getPrice()->getCosts()); |
|
| 139 | + $this->assertEquals('63.00', $basket->getPrice()->getRebate()); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | |
| 143 | 143 | public function testAddBasketProducts() |
| 144 | 144 | { |
| 145 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 146 | - $product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
| 147 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' ); |
|
| 145 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 146 | + $product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
| 147 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product'); |
|
| 148 | 148 | |
| 149 | 149 | $orderProducts = [ |
| 150 | - $manager->createItem()->copyFrom( $product )->setId( 1 ), |
|
| 151 | - $manager->createItem()->copyFrom( $product )->setId( 2 ), |
|
| 150 | + $manager->createItem()->copyFrom($product)->setId(1), |
|
| 151 | + $manager->createItem()->copyFrom($product)->setId(2), |
|
| 152 | 152 | ]; |
| 153 | 153 | |
| 154 | - $basket = $this->access( 'addBasketProducts' )->invokeArgs( $this->object, [$this->context, $basket, $orderProducts, 1] ); |
|
| 154 | + $basket = $this->access('addBasketProducts')->invokeArgs($this->object, [$this->context, $basket, $orderProducts, 1]); |
|
| 155 | 155 | |
| 156 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
| 157 | - $this->assertNull( $basket->getProduct( 0 )->getId() ); |
|
| 156 | + $this->assertEquals(1, count($basket->getProducts())); |
|
| 157 | + $this->assertNull($basket->getProduct(0)->getId()); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
| 161 | 161 | public function testAddBasketServices() |
| 162 | 162 | { |
| 163 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 164 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/service' ); |
|
| 163 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 164 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/service'); |
|
| 165 | 165 | |
| 166 | 166 | $orderServices = [ |
| 167 | - 'delivery' => [$manager->createItem()->setCode( 'shiptest' )], |
|
| 168 | - 'payment' => [$manager->createItem()->setCode( 'paytest' )], |
|
| 167 | + 'delivery' => [$manager->createItem()->setCode('shiptest')], |
|
| 168 | + 'payment' => [$manager->createItem()->setCode('paytest')], |
|
| 169 | 169 | ]; |
| 170 | 170 | |
| 171 | - $basket = $this->access( 'addBasketServices' )->invokeArgs( $this->object, [$this->context, $basket, $orderServices] ); |
|
| 171 | + $basket = $this->access('addBasketServices')->invokeArgs($this->object, [$this->context, $basket, $orderServices]); |
|
| 172 | 172 | |
| 173 | 173 | $class = \Aimeos\MShop\Order\Item\Base\Service\Iface::class; |
| 174 | 174 | |
| 175 | - $this->assertEquals( 2, count( $basket->getServices() ) ); |
|
| 176 | - $this->assertEquals( 1, count( $basket->getService( 'delivery' ) ) ); |
|
| 177 | - $this->assertInstanceOf( $class, $basket->getService( 'delivery', 'unitcode' ) ); |
|
| 178 | - $this->assertEquals( 1, count( $basket->getService( 'payment' ) ) ); |
|
| 179 | - $this->assertInstanceOf( $class, $basket->getService( 'payment', 'paytest' ) ); |
|
| 175 | + $this->assertEquals(2, count($basket->getServices())); |
|
| 176 | + $this->assertEquals(1, count($basket->getService('delivery'))); |
|
| 177 | + $this->assertInstanceOf($class, $basket->getService('delivery', 'unitcode')); |
|
| 178 | + $this->assertEquals(1, count($basket->getService('payment'))); |
|
| 179 | + $this->assertInstanceOf($class, $basket->getService('payment', 'paytest')); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
@@ -184,34 +184,34 @@ discard block |
||
| 184 | 184 | { |
| 185 | 185 | $item = $this->getSubscription(); |
| 186 | 186 | |
| 187 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' ) |
|
| 188 | - ->setConstructorArgs( [$this->context] ) |
|
| 189 | - ->setMethods( ['store'] ) |
|
| 187 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard') |
|
| 188 | + ->setConstructorArgs([$this->context]) |
|
| 189 | + ->setMethods(['store']) |
|
| 190 | 190 | ->getMock(); |
| 191 | 191 | |
| 192 | - \Aimeos\MShop::inject( $this->context, 'order/base', $managerStub ); |
|
| 192 | + \Aimeos\MShop::inject($this->context, 'order/base', $managerStub); |
|
| 193 | 193 | |
| 194 | - $managerStub->expects( $this->once() )->method( 'store' ); |
|
| 194 | + $managerStub->expects($this->once())->method('store'); |
|
| 195 | 195 | |
| 196 | - $this->access( 'createOrderBase' )->invokeArgs( $this->object, [$this->context, $item] ); |
|
| 196 | + $this->access('createOrderBase')->invokeArgs($this->object, [$this->context, $item]); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | |
| 200 | 200 | public function testCreateOrderInvoice() |
| 201 | 201 | { |
| 202 | 202 | $item = $this->getSubscription(); |
| 203 | - $baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() ); |
|
| 203 | + $baseItem = $this->getOrderBaseItem($item->getOrderBaseId()); |
|
| 204 | 204 | |
| 205 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
| 206 | - ->setConstructorArgs( [$this->context] ) |
|
| 207 | - ->setMethods( ['saveItem'] ) |
|
| 205 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
| 206 | + ->setConstructorArgs([$this->context]) |
|
| 207 | + ->setMethods(['saveItem']) |
|
| 208 | 208 | ->getMock(); |
| 209 | 209 | |
| 210 | - \Aimeos\MShop::inject( $this->context, 'order', $managerStub ); |
|
| 210 | + \Aimeos\MShop::inject($this->context, 'order', $managerStub); |
|
| 211 | 211 | |
| 212 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 212 | + $managerStub->expects($this->once())->method('saveItem'); |
|
| 213 | 213 | |
| 214 | - $this->access( 'createOrderInvoice' )->invokeArgs( $this->object, [$this->context, $baseItem] ); |
|
| 214 | + $this->access('createOrderInvoice')->invokeArgs($this->object, [$this->context, $baseItem]); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
@@ -219,55 +219,55 @@ discard block |
||
| 219 | 219 | { |
| 220 | 220 | $item = $this->getSubscription(); |
| 221 | 221 | $invoice = $this->getOrderItem(); |
| 222 | - $baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() ); |
|
| 222 | + $baseItem = $this->getOrderBaseItem($item->getOrderBaseId()); |
|
| 223 | 223 | |
| 224 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
| 225 | - ->setConstructorArgs( [$this->context] ) |
|
| 226 | - ->setMethods( ['saveItem'] ) |
|
| 224 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
| 225 | + ->setConstructorArgs([$this->context]) |
|
| 226 | + ->setMethods(['saveItem']) |
|
| 227 | 227 | ->getMock(); |
| 228 | 228 | |
| 229 | - \Aimeos\MShop::inject( $this->context, 'order', $managerStub ); |
|
| 229 | + \Aimeos\MShop::inject($this->context, 'order', $managerStub); |
|
| 230 | 230 | |
| 231 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 231 | + $managerStub->expects($this->once())->method('saveItem'); |
|
| 232 | 232 | |
| 233 | - $this->access( 'createPayment' )->invokeArgs( $this->object, [$this->context, $baseItem, $invoice] ); |
|
| 233 | + $this->access('createPayment')->invokeArgs($this->object, [$this->context, $baseItem, $invoice]); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
| 237 | 237 | protected function getOrderItem() |
| 238 | 238 | { |
| 239 | - return \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 239 | + return \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
| 243 | - protected function getOrderBaseItem( $baseId ) |
|
| 243 | + protected function getOrderBaseItem($baseId) |
|
| 244 | 244 | { |
| 245 | - return \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->getItem( $baseId, ['order/base/service'] ); |
|
| 245 | + return \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->getItem($baseId, ['order/base/service']); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
| 249 | 249 | protected function getSubscription() |
| 250 | 250 | { |
| 251 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' ); |
|
| 251 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription'); |
|
| 252 | 252 | |
| 253 | 253 | $search = $manager->createSearch(); |
| 254 | - $search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
|
| 254 | + $search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01')); |
|
| 255 | 255 | |
| 256 | - $items = $manager->searchItems( $search ); |
|
| 256 | + $items = $manager->searchItems($search); |
|
| 257 | 257 | |
| 258 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 258 | + if (($item = reset($items)) !== false) { |
|
| 259 | 259 | return $item; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - throw new \Exception( 'No subscription item found' ); |
|
| 262 | + throw new \Exception('No subscription item found'); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | |
| 266 | - protected function access( $name ) |
|
| 266 | + protected function access($name) |
|
| 267 | 267 | { |
| 268 | - $class = new \ReflectionClass( \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard::class ); |
|
| 269 | - $method = $class->getMethod( $name ); |
|
| 270 | - $method->setAccessible( true ); |
|
| 268 | + $class = new \ReflectionClass(\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard::class); |
|
| 269 | + $method = $class->getMethod($name); |
|
| 270 | + $method->setAccessible(true); |
|
| 271 | 271 | |
| 272 | 272 | return $method; |
| 273 | 273 | } |
@@ -20,49 +20,49 @@ discard block |
||
| 20 | 20 | $aimeos = \TestHelperJobs::getAimeos(); |
| 21 | 21 | $this->context = \TestHelperJobs::getContext(); |
| 22 | 22 | |
| 23 | - $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\End\Standard( $this->context, $aimeos ); |
|
| 23 | + $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\End\Standard($this->context, $aimeos); |
|
| 24 | 24 | |
| 25 | - \Aimeos\MShop::cache( true ); |
|
| 25 | + \Aimeos\MShop::cache(true); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | protected function tearDown() |
| 30 | 30 | { |
| 31 | - \Aimeos\MShop::cache( false ); |
|
| 31 | + \Aimeos\MShop::cache(false); |
|
| 32 | 32 | \Aimeos\MShop::clear(); |
| 33 | 33 | |
| 34 | - unset( $this->object, $this->context ); |
|
| 34 | + unset($this->object, $this->context); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public function testGetName() |
| 39 | 39 | { |
| 40 | - $this->assertEquals( 'Subscription process end', $this->object->getName() ); |
|
| 40 | + $this->assertEquals('Subscription process end', $this->object->getName()); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testGetDescription() |
| 45 | 45 | { |
| 46 | - $this->assertEquals( 'Terminates expired subscriptions', $this->object->getDescription() ); |
|
| 46 | + $this->assertEquals('Terminates expired subscriptions', $this->object->getDescription()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testRun() |
| 51 | 51 | { |
| 52 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
| 52 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
| 53 | 53 | $item = $this->getSubscription(); |
| 54 | 54 | |
| 55 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
| 56 | - ->setConstructorArgs( [$this->context] ) |
|
| 57 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
| 55 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
| 56 | + ->setConstructorArgs([$this->context]) |
|
| 57 | + ->setMethods(['searchItems', 'saveItem']) |
|
| 58 | 58 | ->getMock(); |
| 59 | 59 | |
| 60 | - \Aimeos\MShop::inject( $this->context, 'subscription', $managerStub ); |
|
| 60 | + \Aimeos\MShop::inject($this->context, 'subscription', $managerStub); |
|
| 61 | 61 | |
| 62 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
| 63 | - ->will( $this->returnValue( [$item] ) ); |
|
| 62 | + $managerStub->expects($this->once())->method('searchItems') |
|
| 63 | + ->will($this->returnValue([$item])); |
|
| 64 | 64 | |
| 65 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 65 | + $managerStub->expects($this->once())->method('saveItem'); |
|
| 66 | 66 | |
| 67 | 67 | $this->object->run(); |
| 68 | 68 | } |
@@ -70,20 +70,20 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function testRunException() |
| 72 | 72 | { |
| 73 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
| 74 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1'] ); |
|
| 73 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
| 74 | + $this->context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1']); |
|
| 75 | 75 | |
| 76 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
| 77 | - ->setConstructorArgs( [$this->context] ) |
|
| 78 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
| 76 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
| 77 | + ->setConstructorArgs([$this->context]) |
|
| 78 | + ->setMethods(['searchItems', 'saveItem']) |
|
| 79 | 79 | ->getMock(); |
| 80 | 80 | |
| 81 | - \Aimeos\MShop::inject( $this->context, 'subscription', $managerStub ); |
|
| 81 | + \Aimeos\MShop::inject($this->context, 'subscription', $managerStub); |
|
| 82 | 82 | |
| 83 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
| 84 | - ->will( $this->returnValue( [$managerStub->createItem()] ) ); |
|
| 83 | + $managerStub->expects($this->once())->method('searchItems') |
|
| 84 | + ->will($this->returnValue([$managerStub->createItem()])); |
|
| 85 | 85 | |
| 86 | - $managerStub->expects( $this->never() )->method( 'saveItem' ); |
|
| 86 | + $managerStub->expects($this->never())->method('saveItem'); |
|
| 87 | 87 | |
| 88 | 88 | $this->object->run(); |
| 89 | 89 | } |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | protected function getSubscription() |
| 93 | 93 | { |
| 94 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' ); |
|
| 94 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription'); |
|
| 95 | 95 | |
| 96 | 96 | $search = $manager->createSearch(); |
| 97 | - $search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
|
| 97 | + $search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01')); |
|
| 98 | 98 | |
| 99 | - $items = $manager->searchItems( $search ); |
|
| 99 | + $items = $manager->searchItems($search); |
|
| 100 | 100 | |
| 101 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 101 | + if (($item = reset($items)) !== false) { |
|
| 102 | 102 | return $item; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - throw new \Exception( 'No subscription item found' ); |
|
| 105 | + throw new \Exception('No subscription item found'); |
|
| 106 | 106 | } |
| 107 | 107 | } |
@@ -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::createManager( $ctx ); |
|
| 101 | - $locale = $localeManager->bootstrap( $site, 'de', '', false ); |
|
| 102 | - $ctx->setLocale( $locale ); |
|
| 100 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($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 | } |