@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | * @param \Aimeos\MShop\Common\Item\Lists\Iface[] $listItems List of list items |
32 | 32 | * @param \Aimeos\MShop\Common\Item\Iface[] $refItems List of referenced items |
33 | 33 | */ |
34 | - public function __construct( array $values = [], array $listItems = [], array $refItems = [] ) |
|
34 | + public function __construct(array $values = [], array $listItems = [], array $refItems = []) |
|
35 | 35 | { |
36 | - parent::__construct( 'cms.', $values ); |
|
36 | + parent::__construct('cms.', $values); |
|
37 | 37 | |
38 | - $this->initListItems( $listItems, $refItems ); |
|
38 | + $this->initListItems($listItems, $refItems); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function getUrl() : string |
48 | 48 | { |
49 | - return $this->get( 'cms.url', '' ); |
|
49 | + return $this->get('cms.url', ''); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param string $value URL of the cms item |
57 | 57 | * @return \Aimeos\MShop\Cms\Item\Iface Cms item for chaining method calls |
58 | 58 | */ |
59 | - public function setUrl( string $value ) : \Aimeos\MShop\Cms\Item\Iface |
|
59 | + public function setUrl(string $value) : \Aimeos\MShop\Cms\Item\Iface |
|
60 | 60 | { |
61 | - $url = \Aimeos\Map::explode( '/', trim( $value, '/' ) )->map( function( $segment ) { |
|
62 | - return \Aimeos\MW\Str::slug( $segment ); |
|
63 | - } )->join( '/' ); |
|
61 | + $url = \Aimeos\Map::explode('/', trim($value, '/'))->map(function($segment) { |
|
62 | + return \Aimeos\MW\Str::slug($segment); |
|
63 | + } )->join('/'); |
|
64 | 64 | |
65 | - return $this->set( 'cms.url', '/' . $url ); |
|
65 | + return $this->set('cms.url', '/' . $url); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getLabel() : string |
75 | 75 | { |
76 | - return $this->get( 'cms.label', '' ); |
|
76 | + return $this->get('cms.label', ''); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * @param string $label Type label of the attribute item |
84 | 84 | * @return \Aimeos\MShop\Cms\Item\Iface Cms item for chaining method calls |
85 | 85 | */ |
86 | - public function setLabel( ?string $label ) : \Aimeos\MShop\Cms\Item\Iface |
|
86 | + public function setLabel(?string $label) : \Aimeos\MShop\Cms\Item\Iface |
|
87 | 87 | { |
88 | - return $this->set( 'cms.label', (string) $label ); |
|
88 | + return $this->set('cms.label', (string) $label); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function getStatus() : int |
98 | 98 | { |
99 | - return $this->get( 'cms.status', 1 ); |
|
99 | + return $this->get('cms.status', 1); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | * @param int $status true/false for enabled/disabled |
107 | 107 | * @return \Aimeos\MShop\Cms\Item\Iface Cms item for chaining method calls |
108 | 108 | */ |
109 | - public function setStatus( int $status ) : \Aimeos\MShop\Common\Item\Iface |
|
109 | + public function setStatus(int $status) : \Aimeos\MShop\Common\Item\Iface |
|
110 | 110 | { |
111 | - return $this->set( 'cms.status', $status ); |
|
111 | + return $this->set('cms.status', $status); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -141,21 +141,21 @@ discard block |
||
141 | 141 | * @param bool True to set private properties too, false for public only |
142 | 142 | * @return \Aimeos\MShop\Cms\Item\Iface Cms item for chaining method calls |
143 | 143 | */ |
144 | - public function fromArray( array &$list, bool $private = false ) : \Aimeos\MShop\Common\Item\Iface |
|
144 | + public function fromArray(array &$list, bool $private = false) : \Aimeos\MShop\Common\Item\Iface |
|
145 | 145 | { |
146 | - $item = parent::fromArray( $list, $private ); |
|
146 | + $item = parent::fromArray($list, $private); |
|
147 | 147 | |
148 | - foreach( $list as $key => $value ) |
|
148 | + foreach ($list as $key => $value) |
|
149 | 149 | { |
150 | - switch( $key ) |
|
150 | + switch ($key) |
|
151 | 151 | { |
152 | - case 'cms.url': $item = $item->setUrl( $value ); break; |
|
153 | - case 'cms.label': $item = $item->setLabel( $value ); break; |
|
154 | - case 'cms.status': $item = $item->setStatus( (int) $value ); break; |
|
152 | + case 'cms.url': $item = $item->setUrl($value); break; |
|
153 | + case 'cms.label': $item = $item->setLabel($value); break; |
|
154 | + case 'cms.status': $item = $item->setStatus((int) $value); break; |
|
155 | 155 | default: continue 2; |
156 | 156 | } |
157 | 157 | |
158 | - unset( $list[$key] ); |
|
158 | + unset($list[$key]); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | return $item; |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | * @param bool True to return private properties, false for public only |
169 | 169 | * @return array Associative list of item properties and their values |
170 | 170 | */ |
171 | - public function toArray( bool $private = false ) : array |
|
171 | + public function toArray(bool $private = false) : array |
|
172 | 172 | { |
173 | - $list = parent::toArray( $private ); |
|
173 | + $list = parent::toArray($private); |
|
174 | 174 | |
175 | 175 | $list['cms.url'] = $this->getUrl(); |
176 | 176 | $list['cms.label'] = $this->getLabel(); |
@@ -13,16 +13,16 @@ discard block |
||
13 | 13 | |
14 | 14 | $includepaths = $aimeos->getIncludePaths(); |
15 | 15 | $includepaths[] = get_include_path(); |
16 | - set_include_path( implode( PATH_SEPARATOR, $includepaths ) ); |
|
16 | + set_include_path(implode(PATH_SEPARATOR, $includepaths)); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
20 | 20 | private static function getAimeos() |
21 | 21 | { |
22 | - if( !isset( self::$aimeos ) ) |
|
22 | + if (!isset(self::$aimeos)) |
|
23 | 23 | { |
24 | 24 | require_once 'Bootstrap.php'; |
25 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
25 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
26 | 26 | |
27 | 27 | self::$aimeos = new \Aimeos\Bootstrap(); |
28 | 28 | } |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | - public static function getContext( $site = 'unittest' ) |
|
34 | + public static function getContext($site = 'unittest') |
|
35 | 35 | { |
36 | - if( !isset( self::$context[$site] ) ) { |
|
37 | - self::$context[$site] = self::createContext( $site ); |
|
36 | + if (!isset(self::$context[$site])) { |
|
37 | + self::$context[$site] = self::createContext($site); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return clone self::$context[$site]; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * @param string $site |
46 | 46 | */ |
47 | - private static function createContext( $site ) |
|
47 | + private static function createContext($site) |
|
48 | 48 | { |
49 | 49 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
50 | 50 | $aimeos = self::getAimeos(); |
@@ -53,36 +53,36 @@ discard block |
||
53 | 53 | $paths = $aimeos->getConfigPaths(); |
54 | 54 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
55 | 55 | |
56 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
57 | - $ctx->setConfig( $conf ); |
|
56 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
57 | + $ctx->setConfig($conf); |
|
58 | 58 | |
59 | 59 | |
60 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $conf ); |
|
61 | - $ctx->setDatabaseManager( $dbm ); |
|
60 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($conf); |
|
61 | + $ctx->setDatabaseManager($dbm); |
|
62 | 62 | |
63 | 63 | |
64 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
65 | - $ctx->setLogger( $logger ); |
|
64 | + $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
65 | + $ctx->setLogger($logger); |
|
66 | 66 | |
67 | 67 | |
68 | 68 | $cache = new \Aimeos\MW\Cache\None(); |
69 | - $ctx->setCache( $cache ); |
|
69 | + $ctx->setCache($cache); |
|
70 | 70 | |
71 | 71 | |
72 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
73 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
72 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
73 | + $ctx->setI18n(array('de' => $i18n)); |
|
74 | 74 | |
75 | 75 | |
76 | 76 | $session = new \Aimeos\MW\Session\None(); |
77 | - $ctx->setSession( $session ); |
|
77 | + $ctx->setSession($session); |
|
78 | 78 | |
79 | 79 | |
80 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx ); |
|
81 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
80 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create($ctx); |
|
81 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
82 | 82 | |
83 | - $ctx->setLocale( $localeItem ); |
|
83 | + $ctx->setLocale($localeItem); |
|
84 | 84 | |
85 | - $ctx->setEditor( 'ai-cms-grapejs:lib/custom' ); |
|
85 | + $ctx->setEditor('ai-cms-grapejs:lib/custom'); |
|
86 | 86 | |
87 | 87 | return $ctx; |
88 | 88 | } |
@@ -16,28 +16,28 @@ |
||
16 | 16 | { |
17 | 17 | public function testCreateManager() |
18 | 18 | { |
19 | - $manager = \Aimeos\MShop\Cms\Manager\Factory::create( \TestHelperMShop::getContext() ); |
|
20 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $manager ); |
|
19 | + $manager = \Aimeos\MShop\Cms\Manager\Factory::create(\TestHelperMShop::getContext()); |
|
20 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $manager); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | public function testCreateManagerName() |
25 | 25 | { |
26 | - $manager = \Aimeos\MShop\Cms\Manager\Factory::create( \TestHelperMShop::getContext(), 'Standard' ); |
|
27 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $manager ); |
|
26 | + $manager = \Aimeos\MShop\Cms\Manager\Factory::create(\TestHelperMShop::getContext(), 'Standard'); |
|
27 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $manager); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testCreateManagerInvalidName() |
32 | 32 | { |
33 | - $this->expectException( \Aimeos\MShop\Cms\Exception::class ); |
|
34 | - \Aimeos\MShop\Cms\Manager\Factory::create( \TestHelperMShop::getContext(), '%^&' ); |
|
33 | + $this->expectException(\Aimeos\MShop\Cms\Exception::class); |
|
34 | + \Aimeos\MShop\Cms\Manager\Factory::create(\TestHelperMShop::getContext(), '%^&'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testCreateManagerNotExisting() |
39 | 39 | { |
40 | - $this->expectException( \Aimeos\MShop\Exception::class ); |
|
41 | - \Aimeos\MShop\Cms\Manager\Factory::create( \TestHelperMShop::getContext(), 'unknown' ); |
|
40 | + $this->expectException(\Aimeos\MShop\Exception::class); |
|
41 | + \Aimeos\MShop\Cms\Manager\Factory::create(\TestHelperMShop::getContext(), 'unknown'); |
|
42 | 42 | } |
43 | 43 | } |
@@ -18,22 +18,22 @@ discard block |
||
18 | 18 | protected function setUp() : void |
19 | 19 | { |
20 | 20 | $this->editor = \TestHelper::getContext()->getEditor(); |
21 | - $manager = \Aimeos\MShop\Cms\Manager\Factory::create( \TestHelper::getContext() ); |
|
21 | + $manager = \Aimeos\MShop\Cms\Manager\Factory::create(\TestHelper::getContext()); |
|
22 | 22 | |
23 | - $listManager = $manager->getSubManager( 'lists' ); |
|
24 | - $this->object = $listManager->getSubManager( 'type' ); |
|
23 | + $listManager = $manager->getSubManager('lists'); |
|
24 | + $this->object = $listManager->getSubManager('type'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | 28 | protected function tearDown() : void |
29 | 29 | { |
30 | - unset( $this->object ); |
|
30 | + unset($this->object); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | public function testClear() |
35 | 35 | { |
36 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->clear( [-1] ) ); |
|
36 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->clear([-1])); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -41,82 +41,82 @@ discard block |
||
41 | 41 | { |
42 | 42 | $result = $this->object->getResourceType(); |
43 | 43 | |
44 | - $this->assertContains( 'cms/lists/type', $result ); |
|
44 | + $this->assertContains('cms/lists/type', $result); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | public function testCreateItem() |
49 | 49 | { |
50 | 50 | $item = $this->object->create(); |
51 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Type\Iface::class, $item ); |
|
51 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Item\Type\Iface::class, $item); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function testGetItem() |
56 | 56 | { |
57 | - $search = $this->object->filter()->slice( 0, 1 ); |
|
58 | - $search->setConditions( $search->compare( '==', 'cms.lists.type.editor', $this->editor ) ); |
|
59 | - $results = $this->object->search( $search )->toArray(); |
|
57 | + $search = $this->object->filter()->slice(0, 1); |
|
58 | + $search->setConditions($search->compare('==', 'cms.lists.type.editor', $this->editor)); |
|
59 | + $results = $this->object->search($search)->toArray(); |
|
60 | 60 | |
61 | - if( ( $expected = reset( $results ) ) === false ) { |
|
62 | - throw new \RuntimeException( 'No cms list type item found' ); |
|
61 | + if (($expected = reset($results)) === false) { |
|
62 | + throw new \RuntimeException('No cms list type item found'); |
|
63 | 63 | } |
64 | 64 | |
65 | - $this->assertEquals( $expected, $this->object->get( $expected->getId() ) ); |
|
65 | + $this->assertEquals($expected, $this->object->get($expected->getId())); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testSaveUpdateDeleteItem() |
70 | 70 | { |
71 | 71 | $search = $this->object->filter(); |
72 | - $search->setConditions( $search->compare( '==', 'cms.lists.type.editor', $this->editor ) ); |
|
73 | - $results = $this->object->search( $search )->toArray(); |
|
72 | + $search->setConditions($search->compare('==', 'cms.lists.type.editor', $this->editor)); |
|
73 | + $results = $this->object->search($search)->toArray(); |
|
74 | 74 | |
75 | - if( ( $item = reset( $results ) ) === false ) { |
|
76 | - throw new \RuntimeException( 'No type item found' ); |
|
75 | + if (($item = reset($results)) === false) { |
|
76 | + throw new \RuntimeException('No type item found'); |
|
77 | 77 | } |
78 | 78 | |
79 | - $item->setId( null ); |
|
80 | - $item->setCode( 'unitTestSave' ); |
|
81 | - $resultSaved = $this->object->save( $item ); |
|
82 | - $itemSaved = $this->object->get( $item->getId() ); |
|
79 | + $item->setId(null); |
|
80 | + $item->setCode('unitTestSave'); |
|
81 | + $resultSaved = $this->object->save($item); |
|
82 | + $itemSaved = $this->object->get($item->getId()); |
|
83 | 83 | |
84 | 84 | $itemExp = clone $itemSaved; |
85 | - $itemExp->setCode( 'unitTestSave2' ); |
|
86 | - $resultUpd = $this->object->save( $itemExp ); |
|
87 | - $itemUpd = $this->object->get( $itemExp->getId() ); |
|
85 | + $itemExp->setCode('unitTestSave2'); |
|
86 | + $resultUpd = $this->object->save($itemExp); |
|
87 | + $itemUpd = $this->object->get($itemExp->getId()); |
|
88 | 88 | |
89 | - $this->object->delete( $itemSaved->getId() ); |
|
89 | + $this->object->delete($itemSaved->getId()); |
|
90 | 90 | |
91 | 91 | |
92 | - $this->assertTrue( $item->getId() !== null ); |
|
93 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
94 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
95 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
96 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
97 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
98 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
92 | + $this->assertTrue($item->getId() !== null); |
|
93 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
94 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
95 | + $this->assertEquals($item->getCode(), $itemSaved->getCode()); |
|
96 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
97 | + $this->assertEquals($item->getLabel(), $itemSaved->getLabel()); |
|
98 | + $this->assertEquals($item->getStatus(), $itemSaved->getStatus()); |
|
99 | 99 | |
100 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
101 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
102 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
100 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
101 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
102 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
103 | 103 | |
104 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
105 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
106 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
107 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
108 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
109 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
104 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
105 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
106 | + $this->assertEquals($itemExp->getCode(), $itemUpd->getCode()); |
|
107 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
108 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
109 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
110 | 110 | |
111 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
112 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
113 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
111 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
112 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
113 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
114 | 114 | |
115 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultSaved ); |
|
116 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultUpd ); |
|
115 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultSaved); |
|
116 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultUpd); |
|
117 | 117 | |
118 | - $this->expectException( \Aimeos\MShop\Exception::class ); |
|
119 | - $this->object->get( $itemSaved->getId() ); |
|
118 | + $this->expectException(\Aimeos\MShop\Exception::class); |
|
119 | + $this->object->get($itemSaved->getId()); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -126,19 +126,19 @@ discard block |
||
126 | 126 | $search = $this->object->filter(); |
127 | 127 | |
128 | 128 | $expr = []; |
129 | - $expr[] = $search->compare( '!=', 'cms.lists.type.id', null ); |
|
130 | - $expr[] = $search->compare( '!=', 'cms.lists.type.siteid', null ); |
|
131 | - $expr[] = $search->compare( '==', 'cms.lists.type.code', 'default' ); |
|
132 | - $expr[] = $search->compare( '==', 'cms.lists.type.domain', 'text' ); |
|
133 | - $expr[] = $search->compare( '>', 'cms.lists.type.label', '' ); |
|
134 | - $expr[] = $search->compare( '>=', 'cms.lists.type.position', 0 ); |
|
135 | - $expr[] = $search->compare( '==', 'cms.lists.type.status', 1 ); |
|
136 | - $expr[] = $search->compare( '==', 'cms.lists.type.editor', $this->editor ); |
|
137 | - |
|
138 | - $search->setConditions( $search->and( $expr ) ); |
|
139 | - |
|
140 | - $results = $this->object->search( $search, [], $total )->toArray(); |
|
141 | - $this->assertEquals( 1, count( $results ) ); |
|
129 | + $expr[] = $search->compare('!=', 'cms.lists.type.id', null); |
|
130 | + $expr[] = $search->compare('!=', 'cms.lists.type.siteid', null); |
|
131 | + $expr[] = $search->compare('==', 'cms.lists.type.code', 'default'); |
|
132 | + $expr[] = $search->compare('==', 'cms.lists.type.domain', 'text'); |
|
133 | + $expr[] = $search->compare('>', 'cms.lists.type.label', ''); |
|
134 | + $expr[] = $search->compare('>=', 'cms.lists.type.position', 0); |
|
135 | + $expr[] = $search->compare('==', 'cms.lists.type.status', 1); |
|
136 | + $expr[] = $search->compare('==', 'cms.lists.type.editor', $this->editor); |
|
137 | + |
|
138 | + $search->setConditions($search->and($expr)); |
|
139 | + |
|
140 | + $results = $this->object->search($search, [], $total)->toArray(); |
|
141 | + $this->assertEquals(1, count($results)); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -147,18 +147,18 @@ discard block |
||
147 | 147 | $total = 0; |
148 | 148 | $search = $this->object->filter(); |
149 | 149 | $conditions = array( |
150 | - $search->compare( '==', 'cms.lists.type.code', 'default' ), |
|
151 | - $search->compare( '==', 'cms.lists.type.editor', $this->editor ), |
|
150 | + $search->compare('==', 'cms.lists.type.code', 'default'), |
|
151 | + $search->compare('==', 'cms.lists.type.editor', $this->editor), |
|
152 | 152 | ); |
153 | - $search->setConditions( $search->and( $conditions ) ); |
|
154 | - $search->setSortations( [$search->sort( '-', 'cms.lists.type.position' )] ); |
|
155 | - $search->slice( 0, 1 ); |
|
156 | - $results = $this->object->search( $search, [], $total )->toArray(); |
|
157 | - $this->assertEquals( 1, count( $results ) ); |
|
158 | - $this->assertEquals( 1, $total ); |
|
159 | - |
|
160 | - foreach( $results as $itemId => $item ) { |
|
161 | - $this->assertEquals( $itemId, $item->getId() ); |
|
153 | + $search->setConditions($search->and($conditions)); |
|
154 | + $search->setSortations([$search->sort('-', 'cms.lists.type.position')]); |
|
155 | + $search->slice(0, 1); |
|
156 | + $results = $this->object->search($search, [], $total)->toArray(); |
|
157 | + $this->assertEquals(1, count($results)); |
|
158 | + $this->assertEquals(1, $total); |
|
159 | + |
|
160 | + foreach ($results as $itemId => $item) { |
|
161 | + $this->assertEquals($itemId, $item->getId()); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 |
@@ -20,20 +20,20 @@ discard block |
||
20 | 20 | { |
21 | 21 | $this->concms = \TestHelper::getContext(); |
22 | 22 | $this->editor = $this->concms->getEditor(); |
23 | - $manager = \Aimeos\MShop\Cms\Manager\Factory::create( $this->concms, 'Standard' ); |
|
24 | - $this->object = $manager->getSubManager( 'lists', 'Standard' ); |
|
23 | + $manager = \Aimeos\MShop\Cms\Manager\Factory::create($this->concms, 'Standard'); |
|
24 | + $this->object = $manager->getSubManager('lists', 'Standard'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | 28 | protected function tearDown() : void |
29 | 29 | { |
30 | - unset( $this->object, $this->concms ); |
|
30 | + unset($this->object, $this->concms); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | public function testClear() |
35 | 35 | { |
36 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->clear( [-1] ) ); |
|
36 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->clear([-1])); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -41,99 +41,99 @@ discard block |
||
41 | 41 | { |
42 | 42 | $result = $this->object->getResourceType(); |
43 | 43 | |
44 | - $this->assertContains( 'cms/lists', $result ); |
|
44 | + $this->assertContains('cms/lists', $result); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | public function testAggregate() |
49 | 49 | { |
50 | - $search = $this->object->filter( true ); |
|
50 | + $search = $this->object->filter(true); |
|
51 | 51 | $expr = array( |
52 | 52 | $search->getConditions(), |
53 | - $search->compare( '==', 'cms.lists.editor', $this->editor ), |
|
53 | + $search->compare('==', 'cms.lists.editor', $this->editor), |
|
54 | 54 | ); |
55 | - $search->setConditions( $search->and( $expr ) ); |
|
55 | + $search->setConditions($search->and($expr)); |
|
56 | 56 | |
57 | - $result = $this->object->aggregate( $search, 'cms.lists.domain' )->toArray(); |
|
57 | + $result = $this->object->aggregate($search, 'cms.lists.domain')->toArray(); |
|
58 | 58 | |
59 | - $this->assertEquals( 1, count( $result ) ); |
|
60 | - $this->assertArrayHasKey( 'text', $result ); |
|
61 | - $this->assertEquals( 6, $result['text'] ); |
|
59 | + $this->assertEquals(1, count($result)); |
|
60 | + $this->assertArrayHasKey('text', $result); |
|
61 | + $this->assertEquals(6, $result['text']); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | public function testCreateItem() |
66 | 66 | { |
67 | 67 | $item = $this->object->create(); |
68 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Lists\Iface::class, $item ); |
|
68 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Item\Lists\Iface::class, $item); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | 72 | public function testGetItem() |
73 | 73 | { |
74 | - $search = $this->object->filter()->slice( 0, 1 ); |
|
75 | - $search->setConditions( $search->compare( '==', 'cms.lists.editor', $this->editor ) ); |
|
76 | - $item = $this->object->search( $search )->first( new \RuntimeException( 'No item found' ) ); |
|
74 | + $search = $this->object->filter()->slice(0, 1); |
|
75 | + $search->setConditions($search->compare('==', 'cms.lists.editor', $this->editor)); |
|
76 | + $item = $this->object->search($search)->first(new \RuntimeException('No item found')); |
|
77 | 77 | |
78 | - $this->assertEquals( $item, $this->object->get( $item->getId() ) ); |
|
78 | + $this->assertEquals($item, $this->object->get($item->getId())); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
82 | 82 | public function testSaveUpdateDeleteItem() |
83 | 83 | { |
84 | 84 | $search = $this->object->filter(); |
85 | - $search->setConditions( $search->compare( '==', 'cms.lists.editor', $this->editor ) ); |
|
86 | - $item = $this->object->search( $search )->first( new \RuntimeException( 'No item found' ) ); |
|
85 | + $search->setConditions($search->compare('==', 'cms.lists.editor', $this->editor)); |
|
86 | + $item = $this->object->search($search)->first(new \RuntimeException('No item found')); |
|
87 | 87 | |
88 | - $item->setId( null ); |
|
89 | - $item->setDomain( 'unittest' ); |
|
90 | - $resultSaved = $this->object->save( $item ); |
|
91 | - $itemSaved = $this->object->get( $item->getId() ); |
|
88 | + $item->setId(null); |
|
89 | + $item->setDomain('unittest'); |
|
90 | + $resultSaved = $this->object->save($item); |
|
91 | + $itemSaved = $this->object->get($item->getId()); |
|
92 | 92 | |
93 | 93 | $itemExp = clone $itemSaved; |
94 | - $itemExp->setDomain( 'unittest1' ); |
|
95 | - $resultUpd = $this->object->save( $itemExp ); |
|
96 | - $itemUpd = $this->object->get( $itemExp->getId() ); |
|
97 | - |
|
98 | - $this->object->delete( $itemSaved->getId() ); |
|
99 | - |
|
100 | - |
|
101 | - $this->assertTrue( $item->getId() !== null ); |
|
102 | - $this->assertTrue( $itemSaved->getType() !== null ); |
|
103 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
104 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
105 | - $this->assertEquals( $item->getParentId(), $itemSaved->getParentId() ); |
|
106 | - $this->assertEquals( $item->getType(), $itemSaved->getType() ); |
|
107 | - $this->assertEquals( $item->getRefId(), $itemSaved->getRefId() ); |
|
108 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
109 | - $this->assertEquals( $item->getDateStart(), $itemSaved->getDateStart() ); |
|
110 | - $this->assertEquals( $item->getDateEnd(), $itemSaved->getDateEnd() ); |
|
111 | - $this->assertEquals( $item->getPosition(), $itemSaved->getPosition() ); |
|
112 | - |
|
113 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
114 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
115 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
116 | - |
|
117 | - $this->assertTrue( $itemUpd->getType() !== null ); |
|
118 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
119 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
120 | - $this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() ); |
|
121 | - $this->assertEquals( $itemExp->getType(), $itemUpd->getType() ); |
|
122 | - $this->assertEquals( $itemExp->getRefId(), $itemUpd->getRefId() ); |
|
123 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
124 | - $this->assertEquals( $itemExp->getDateStart(), $itemUpd->getDateStart() ); |
|
125 | - $this->assertEquals( $itemExp->getDateEnd(), $itemUpd->getDateEnd() ); |
|
126 | - $this->assertEquals( $itemExp->getPosition(), $itemUpd->getPosition() ); |
|
127 | - |
|
128 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
129 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
130 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
131 | - |
|
132 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultSaved ); |
|
133 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultUpd ); |
|
134 | - |
|
135 | - $this->expectException( \Aimeos\MShop\Exception::class ); |
|
136 | - $this->object->get( $itemSaved->getId() ); |
|
94 | + $itemExp->setDomain('unittest1'); |
|
95 | + $resultUpd = $this->object->save($itemExp); |
|
96 | + $itemUpd = $this->object->get($itemExp->getId()); |
|
97 | + |
|
98 | + $this->object->delete($itemSaved->getId()); |
|
99 | + |
|
100 | + |
|
101 | + $this->assertTrue($item->getId() !== null); |
|
102 | + $this->assertTrue($itemSaved->getType() !== null); |
|
103 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
104 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
105 | + $this->assertEquals($item->getParentId(), $itemSaved->getParentId()); |
|
106 | + $this->assertEquals($item->getType(), $itemSaved->getType()); |
|
107 | + $this->assertEquals($item->getRefId(), $itemSaved->getRefId()); |
|
108 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
109 | + $this->assertEquals($item->getDateStart(), $itemSaved->getDateStart()); |
|
110 | + $this->assertEquals($item->getDateEnd(), $itemSaved->getDateEnd()); |
|
111 | + $this->assertEquals($item->getPosition(), $itemSaved->getPosition()); |
|
112 | + |
|
113 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
114 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
115 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
116 | + |
|
117 | + $this->assertTrue($itemUpd->getType() !== null); |
|
118 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
119 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
120 | + $this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId()); |
|
121 | + $this->assertEquals($itemExp->getType(), $itemUpd->getType()); |
|
122 | + $this->assertEquals($itemExp->getRefId(), $itemUpd->getRefId()); |
|
123 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
124 | + $this->assertEquals($itemExp->getDateStart(), $itemUpd->getDateStart()); |
|
125 | + $this->assertEquals($itemExp->getDateEnd(), $itemUpd->getDateEnd()); |
|
126 | + $this->assertEquals($itemExp->getPosition(), $itemUpd->getPosition()); |
|
127 | + |
|
128 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
129 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
130 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
131 | + |
|
132 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultSaved); |
|
133 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultUpd); |
|
134 | + |
|
135 | + $this->expectException(\Aimeos\MShop\Exception::class); |
|
136 | + $this->object->get($itemSaved->getId()); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -143,59 +143,59 @@ discard block |
||
143 | 143 | $search = $this->object->filter(); |
144 | 144 | |
145 | 145 | $expr = []; |
146 | - $expr[] = $search->compare( '!=', 'cms.lists.id', null ); |
|
147 | - $expr[] = $search->compare( '!=', 'cms.lists.siteid', null ); |
|
148 | - $expr[] = $search->compare( '!=', 'cms.lists.parentid', null ); |
|
149 | - $expr[] = $search->compare( '==', 'cms.lists.domain', 'text' ); |
|
150 | - $expr[] = $search->compare( '==', 'cms.lists.type', 'default' ); |
|
151 | - $expr[] = $search->compare( '>', 'cms.lists.refid', 0 ); |
|
152 | - $expr[] = $search->compare( '==', 'cms.lists.datestart', null ); |
|
153 | - $expr[] = $search->compare( '==', 'cms.lists.dateend', null ); |
|
154 | - $expr[] = $search->compare( '!=', 'cms.lists.config', null ); |
|
155 | - $expr[] = $search->compare( '==', 'cms.lists.position', 0 ); |
|
156 | - $expr[] = $search->compare( '==', 'cms.lists.status', 1 ); |
|
157 | - $expr[] = $search->compare( '==', 'cms.lists.editor', $this->editor ); |
|
158 | - |
|
159 | - $search->setConditions( $search->and( $expr ) ); |
|
160 | - $results = $this->object->search( $search, [], $total )->toArray(); |
|
161 | - $this->assertEquals( 2, count( $results ) ); |
|
146 | + $expr[] = $search->compare('!=', 'cms.lists.id', null); |
|
147 | + $expr[] = $search->compare('!=', 'cms.lists.siteid', null); |
|
148 | + $expr[] = $search->compare('!=', 'cms.lists.parentid', null); |
|
149 | + $expr[] = $search->compare('==', 'cms.lists.domain', 'text'); |
|
150 | + $expr[] = $search->compare('==', 'cms.lists.type', 'default'); |
|
151 | + $expr[] = $search->compare('>', 'cms.lists.refid', 0); |
|
152 | + $expr[] = $search->compare('==', 'cms.lists.datestart', null); |
|
153 | + $expr[] = $search->compare('==', 'cms.lists.dateend', null); |
|
154 | + $expr[] = $search->compare('!=', 'cms.lists.config', null); |
|
155 | + $expr[] = $search->compare('==', 'cms.lists.position', 0); |
|
156 | + $expr[] = $search->compare('==', 'cms.lists.status', 1); |
|
157 | + $expr[] = $search->compare('==', 'cms.lists.editor', $this->editor); |
|
158 | + |
|
159 | + $search->setConditions($search->and($expr)); |
|
160 | + $results = $this->object->search($search, [], $total)->toArray(); |
|
161 | + $this->assertEquals(2, count($results)); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
165 | 165 | public function testSearchItemsAll() |
166 | 166 | { |
167 | 167 | $search = $this->object->filter(); |
168 | - $search->setConditions( $search->compare( '==', 'cms.lists.editor', $this->editor ) ); |
|
169 | - $this->assertEquals( 6, count( $this->object->search( $search )->toArray() ) ); |
|
168 | + $search->setConditions($search->compare('==', 'cms.lists.editor', $this->editor)); |
|
169 | + $this->assertEquals(6, count($this->object->search($search)->toArray())); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
173 | 173 | public function testSearchItemsBase() |
174 | 174 | { |
175 | 175 | $total = 0; |
176 | - $search = $this->object->filter( true ); |
|
176 | + $search = $this->object->filter(true); |
|
177 | 177 | $conditions = array( |
178 | - $search->compare( '==', 'cms.lists.editor', $this->editor ), |
|
178 | + $search->compare('==', 'cms.lists.editor', $this->editor), |
|
179 | 179 | $search->getConditions() |
180 | 180 | ); |
181 | - $search->setConditions( $search->and( $conditions ) ); |
|
182 | - $search->slice( 0, 1 ); |
|
183 | - $results = $this->object->search( $search, [], $total )->toArray(); |
|
184 | - $this->assertEquals( 1, count( $results ) ); |
|
185 | - $this->assertEquals( 6, $total ); |
|
186 | - |
|
187 | - foreach( $results as $itemId => $item ) { |
|
188 | - $this->assertEquals( $itemId, $item->getId() ); |
|
181 | + $search->setConditions($search->and($conditions)); |
|
182 | + $search->slice(0, 1); |
|
183 | + $results = $this->object->search($search, [], $total)->toArray(); |
|
184 | + $this->assertEquals(1, count($results)); |
|
185 | + $this->assertEquals(6, $total); |
|
186 | + |
|
187 | + foreach ($results as $itemId => $item) { |
|
188 | + $this->assertEquals($itemId, $item->getId()); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | 192 | |
193 | 193 | public function testGetSubManager() |
194 | 194 | { |
195 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'type' ) ); |
|
196 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'type', 'Standard' ) ); |
|
195 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('type')); |
|
196 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('type', 'Standard')); |
|
197 | 197 | |
198 | - $this->expectException( \Aimeos\MShop\Exception::class ); |
|
199 | - $this->object->getSubManager( 'unknown' ); |
|
198 | + $this->expectException(\Aimeos\MShop\Exception::class); |
|
199 | + $this->object->getSubManager('unknown'); |
|
200 | 200 | } |
201 | 201 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | protected function setUp() : void |
18 | 18 | { |
19 | 19 | $this->editor = \TestHelper::getContext()->getEditor(); |
20 | - $this->object = new \Aimeos\MShop\Cms\Manager\Standard( \TestHelper::getContext() ); |
|
20 | + $this->object = new \Aimeos\MShop\Cms\Manager\Standard(\TestHelper::getContext()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -29,27 +29,27 @@ discard block |
||
29 | 29 | |
30 | 30 | public function testClear() |
31 | 31 | { |
32 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->clear( [-1] ) ); |
|
32 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->clear([-1])); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testDeleteItems() |
37 | 37 | { |
38 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->delete( [-1] ) ); |
|
38 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->delete([-1])); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | 42 | public function testCreateItem() |
43 | 43 | { |
44 | 44 | $cmsItem = $this->object->create(); |
45 | - $this->assertInstanceOf( \Aimeos\MShop\Cms\Item\Iface::class, $cmsItem ); |
|
45 | + $this->assertInstanceOf(\Aimeos\MShop\Cms\Item\Iface::class, $cmsItem); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testCreateItemType() |
50 | 50 | { |
51 | - $item = $this->object->create( ['cms.url' => '/test'] ); |
|
52 | - $this->assertEquals( '/test', $item->getUrl() ); |
|
51 | + $item = $this->object->create(['cms.url' => '/test']); |
|
52 | + $this->assertEquals('/test', $item->getUrl()); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -57,150 +57,150 @@ discard block |
||
57 | 57 | { |
58 | 58 | $result = $this->object->getResourceType(); |
59 | 59 | |
60 | - $this->assertContains( 'cms', $result ); |
|
61 | - $this->assertContains( 'cms/lists', $result ); |
|
60 | + $this->assertContains('cms', $result); |
|
61 | + $this->assertContains('cms/lists', $result); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | public function testGetSearchAttributes() |
66 | 66 | { |
67 | - foreach( $this->object->getSearchAttributes() as $attribute ) { |
|
68 | - $this->assertInstanceOf( \Aimeos\MW\Criteria\Attribute\Iface::class, $attribute ); |
|
67 | + foreach ($this->object->getSearchAttributes() as $attribute) { |
|
68 | + $this->assertInstanceOf(\Aimeos\MW\Criteria\Attribute\Iface::class, $attribute); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | 72 | |
73 | 73 | public function testSearchItems() |
74 | 74 | { |
75 | - $item = $this->object->find( '/contact', ['text'] ); |
|
76 | - $listItem = $item->getListItems( 'text', 'default' )->first( new \RuntimeException( 'No list item found' ) ); |
|
75 | + $item = $this->object->find('/contact', ['text']); |
|
76 | + $listItem = $item->getListItems('text', 'default')->first(new \RuntimeException('No list item found')); |
|
77 | 77 | |
78 | 78 | $total = 0; |
79 | 79 | $search = $this->object->filter(); |
80 | 80 | |
81 | 81 | $expr = []; |
82 | - $expr[] = $search->compare( '!=', 'cms.id', null ); |
|
83 | - $expr[] = $search->compare( '!=', 'cms.siteid', null ); |
|
84 | - $expr[] = $search->compare( '==', 'cms.url', '/contact' ); |
|
85 | - $expr[] = $search->compare( '==', 'cms.label', 'Contact' ); |
|
86 | - $expr[] = $search->compare( '==', 'cms.status', 1 ); |
|
87 | - $expr[] = $search->compare( '>=', 'cms.mtime', '1970-01-01 00:00:00' ); |
|
88 | - $expr[] = $search->compare( '>=', 'cms.ctime', '1970-01-01 00:00:00' ); |
|
89 | - $expr[] = $search->compare( '==', 'cms.editor', $this->editor ); |
|
82 | + $expr[] = $search->compare('!=', 'cms.id', null); |
|
83 | + $expr[] = $search->compare('!=', 'cms.siteid', null); |
|
84 | + $expr[] = $search->compare('==', 'cms.url', '/contact'); |
|
85 | + $expr[] = $search->compare('==', 'cms.label', 'Contact'); |
|
86 | + $expr[] = $search->compare('==', 'cms.status', 1); |
|
87 | + $expr[] = $search->compare('>=', 'cms.mtime', '1970-01-01 00:00:00'); |
|
88 | + $expr[] = $search->compare('>=', 'cms.ctime', '1970-01-01 00:00:00'); |
|
89 | + $expr[] = $search->compare('==', 'cms.editor', $this->editor); |
|
90 | 90 | |
91 | 91 | $param = ['text', 'default', $listItem->getRefId()]; |
92 | - $expr[] = $search->compare( '!=', $search->make( 'cms:has', $param ), null ); |
|
92 | + $expr[] = $search->compare('!=', $search->make('cms:has', $param), null); |
|
93 | 93 | |
94 | 94 | $param = ['text', 'default']; |
95 | - $expr[] = $search->compare( '!=', $search->make( 'cms:has', $param ), null ); |
|
95 | + $expr[] = $search->compare('!=', $search->make('cms:has', $param), null); |
|
96 | 96 | |
97 | 97 | $param = ['text']; |
98 | - $expr[] = $search->compare( '!=', $search->make( 'cms:has', $param ), null ); |
|
98 | + $expr[] = $search->compare('!=', $search->make('cms:has', $param), null); |
|
99 | 99 | |
100 | - $search->setConditions( $search->and( $expr ) ); |
|
101 | - $result = $this->object->search( $search, [], $total )->toArray(); |
|
102 | - $this->assertEquals( 1, count( $result ) ); |
|
103 | - $this->assertEquals( 1, $total ); |
|
100 | + $search->setConditions($search->and($expr)); |
|
101 | + $result = $this->object->search($search, [], $total)->toArray(); |
|
102 | + $this->assertEquals(1, count($result)); |
|
103 | + $this->assertEquals(1, $total); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
107 | 107 | public function testSearchItemsAll() |
108 | 108 | { |
109 | 109 | $search = $this->object->filter(); |
110 | - $search->setConditions( $search->compare( '==', 'cms.editor', $this->editor ) ); |
|
111 | - $this->assertEquals( 2, count( $this->object->search( $search )->toArray() ) ); |
|
110 | + $search->setConditions($search->compare('==', 'cms.editor', $this->editor)); |
|
111 | + $this->assertEquals(2, count($this->object->search($search)->toArray())); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | 115 | public function testSearchItemsBase() |
116 | 116 | { |
117 | 117 | $total = 0; |
118 | - $search = $this->object->filter( true ); |
|
118 | + $search = $this->object->filter(true); |
|
119 | 119 | $conditions = array( |
120 | - $search->compare( '==', 'cms.editor', $this->editor ), |
|
120 | + $search->compare('==', 'cms.editor', $this->editor), |
|
121 | 121 | $search->getConditions() |
122 | 122 | ); |
123 | - $search->setConditions( $search->and( $conditions ) ); |
|
124 | - $search->slice( 0, 1 ); |
|
125 | - $results = $this->object->search( $search, [], $total )->toArray(); |
|
126 | - $this->assertEquals( 1, count( $results ) ); |
|
127 | - $this->assertEquals( 1, $total ); |
|
128 | - |
|
129 | - foreach( $results as $itemId => $item ) { |
|
130 | - $this->assertEquals( $itemId, $item->getId() ); |
|
123 | + $search->setConditions($search->and($conditions)); |
|
124 | + $search->slice(0, 1); |
|
125 | + $results = $this->object->search($search, [], $total)->toArray(); |
|
126 | + $this->assertEquals(1, count($results)); |
|
127 | + $this->assertEquals(1, $total); |
|
128 | + |
|
129 | + foreach ($results as $itemId => $item) { |
|
130 | + $this->assertEquals($itemId, $item->getId()); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | 134 | |
135 | 135 | public function testGetItem() |
136 | 136 | { |
137 | - $item = $this->object->find( '/contact' ); |
|
137 | + $item = $this->object->find('/contact'); |
|
138 | 138 | |
139 | - $actual = $this->object->get( $item->getId() ); |
|
140 | - $this->assertEquals( $item, $actual ); |
|
139 | + $actual = $this->object->get($item->getId()); |
|
140 | + $this->assertEquals($item, $actual); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
144 | 144 | public function testSaveUpdateDeleteItem() |
145 | 145 | { |
146 | - $item = $this->object->find( '/contact' ); |
|
146 | + $item = $this->object->find('/contact'); |
|
147 | 147 | |
148 | - $item->setId( null ); |
|
149 | - $item->setUrl( '/contact-test' ); |
|
150 | - $item->setLabel( 'Contact test' ); |
|
151 | - $resultSaved = $this->object->save( $item ); |
|
152 | - $itemSaved = $this->object->get( $item->getId() ); |
|
148 | + $item->setId(null); |
|
149 | + $item->setUrl('/contact-test'); |
|
150 | + $item->setLabel('Contact test'); |
|
151 | + $resultSaved = $this->object->save($item); |
|
152 | + $itemSaved = $this->object->get($item->getId()); |
|
153 | 153 | |
154 | 154 | $itemExp = clone $itemSaved; |
155 | - $itemExp->setLabel( 'Contact test 2' ); |
|
156 | - $resultUpd = $this->object->save( $itemExp ); |
|
157 | - $itemUpd = $this->object->get( $itemExp->getId() ); |
|
155 | + $itemExp->setLabel('Contact test 2'); |
|
156 | + $resultUpd = $this->object->save($itemExp); |
|
157 | + $itemUpd = $this->object->get($itemExp->getId()); |
|
158 | 158 | |
159 | - $this->object->delete( $itemSaved->getId() ); |
|
159 | + $this->object->delete($itemSaved->getId()); |
|
160 | 160 | |
161 | 161 | |
162 | - $this->assertTrue( $item->getId() !== null ); |
|
163 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
164 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
165 | - $this->assertEquals( $item->getUrl(), $itemSaved->getUrl() ); |
|
166 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
167 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
162 | + $this->assertTrue($item->getId() !== null); |
|
163 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
164 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
165 | + $this->assertEquals($item->getUrl(), $itemSaved->getUrl()); |
|
166 | + $this->assertEquals($item->getLabel(), $itemSaved->getLabel()); |
|
167 | + $this->assertEquals($item->getStatus(), $itemSaved->getStatus()); |
|
168 | 168 | |
169 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
170 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
171 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
169 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
170 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
171 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
172 | 172 | |
173 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
174 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
175 | - $this->assertEquals( $itemExp->getUrl(), $itemUpd->getUrl() ); |
|
176 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
177 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
173 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
174 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
175 | + $this->assertEquals($itemExp->getUrl(), $itemUpd->getUrl()); |
|
176 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
177 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
178 | 178 | |
179 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
180 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
181 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
179 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
180 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
181 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
182 | 182 | |
183 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultSaved ); |
|
184 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultUpd ); |
|
183 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultSaved); |
|
184 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultUpd); |
|
185 | 185 | |
186 | - $this->expectException( \Aimeos\MShop\Exception::class ); |
|
187 | - $this->object->get( $itemSaved->getId() ); |
|
186 | + $this->expectException(\Aimeos\MShop\Exception::class); |
|
187 | + $this->object->get($itemSaved->getId()); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
191 | 191 | public function testGetSubManager() |
192 | 192 | { |
193 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'lists' ) ); |
|
194 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'lists', 'Standard' ) ); |
|
193 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('lists')); |
|
194 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('lists', 'Standard')); |
|
195 | 195 | |
196 | - $this->expectException( \Aimeos\MShop\Exception::class ); |
|
197 | - $this->object->getSubManager( 'unknown' ); |
|
196 | + $this->expectException(\Aimeos\MShop\Exception::class); |
|
197 | + $this->object->getSubManager('unknown'); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
201 | 201 | public function testGetSubManagerInvalidName() |
202 | 202 | { |
203 | - $this->expectException( \Aimeos\MShop\Exception::class ); |
|
204 | - $this->object->getSubManager( 'lists', 'unknown' ); |
|
203 | + $this->expectException(\Aimeos\MShop\Exception::class); |
|
204 | + $this->object->getSubManager('lists', 'unknown'); |
|
205 | 205 | } |
206 | 206 | } |
@@ -28,123 +28,123 @@ discard block |
||
28 | 28 | 'cms.editor' => 'unitTestUser', |
29 | 29 | ); |
30 | 30 | |
31 | - $this->object = new \Aimeos\MShop\Cms\Item\Standard( $this->values ); |
|
31 | + $this->object = new \Aimeos\MShop\Cms\Item\Standard($this->values); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function tearDown() : void |
36 | 36 | { |
37 | - unset( $this->object ); |
|
37 | + unset($this->object); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | public function testIsModified() |
42 | 42 | { |
43 | - $this->assertFalse( $this->object->isModified() ); |
|
43 | + $this->assertFalse($this->object->isModified()); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | public function testGetId() |
48 | 48 | { |
49 | - $this->assertEquals( '10', $this->object->getId() ); |
|
49 | + $this->assertEquals('10', $this->object->getId()); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testSetId() |
54 | 54 | { |
55 | - $return = $this->object->setId( null ); |
|
55 | + $return = $this->object->setId(null); |
|
56 | 56 | |
57 | - $this->assertInstanceOf( \Aimeos\MShop\Cms\Item\Iface::class, $return ); |
|
58 | - $this->assertNull( $this->object->getId() ); |
|
59 | - $this->assertTrue( $this->object->isModified() ); |
|
57 | + $this->assertInstanceOf(\Aimeos\MShop\Cms\Item\Iface::class, $return); |
|
58 | + $this->assertNull($this->object->getId()); |
|
59 | + $this->assertTrue($this->object->isModified()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | public function testGetSiteId() |
64 | 64 | { |
65 | - $this->assertEquals( 99, $this->object->getSiteId() ); |
|
65 | + $this->assertEquals(99, $this->object->getSiteId()); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testGetUrl() |
70 | 70 | { |
71 | - $this->assertEquals( '/test', $this->object->getUrl() ); |
|
71 | + $this->assertEquals('/test', $this->object->getUrl()); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | public function testSetUrl() |
76 | 76 | { |
77 | - $return = $this->object->setUrl( '/test2' ); |
|
77 | + $return = $this->object->setUrl('/test2'); |
|
78 | 78 | |
79 | - $this->assertInstanceOf( \Aimeos\MShop\Cms\Item\Iface::class, $return ); |
|
80 | - $this->assertEquals( '/test2', $this->object->getUrl() ); |
|
81 | - $this->assertTrue( $this->object->isModified() ); |
|
79 | + $this->assertInstanceOf(\Aimeos\MShop\Cms\Item\Iface::class, $return); |
|
80 | + $this->assertEquals('/test2', $this->object->getUrl()); |
|
81 | + $this->assertTrue($this->object->isModified()); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | 85 | public function testSetUrlTransform() |
86 | 86 | { |
87 | - $return = $this->object->setUrl( '/Äpfel/Birnen' ); |
|
87 | + $return = $this->object->setUrl('/Äpfel/Birnen'); |
|
88 | 88 | |
89 | - $this->assertInstanceOf( \Aimeos\MShop\Cms\Item\Iface::class, $return ); |
|
90 | - $this->assertEquals( '/Apfel/Birnen', $this->object->getUrl() ); |
|
91 | - $this->assertTrue( $this->object->isModified() ); |
|
89 | + $this->assertInstanceOf(\Aimeos\MShop\Cms\Item\Iface::class, $return); |
|
90 | + $this->assertEquals('/Apfel/Birnen', $this->object->getUrl()); |
|
91 | + $this->assertTrue($this->object->isModified()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
95 | 95 | public function testGetLabel() |
96 | 96 | { |
97 | - $this->assertEquals( 'unittest label', $this->object->getLabel() ); |
|
97 | + $this->assertEquals('unittest label', $this->object->getLabel()); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | 101 | public function testSetLabel() |
102 | 102 | { |
103 | - $return = $this->object->setLabel( 'unittest set label' ); |
|
103 | + $return = $this->object->setLabel('unittest set label'); |
|
104 | 104 | |
105 | - $this->assertInstanceOf( \Aimeos\MShop\Cms\Item\Iface::class, $return ); |
|
106 | - $this->assertEquals( 'unittest set label', $this->object->getLabel() ); |
|
107 | - $this->assertTrue( $this->object->isModified() ); |
|
105 | + $this->assertInstanceOf(\Aimeos\MShop\Cms\Item\Iface::class, $return); |
|
106 | + $this->assertEquals('unittest set label', $this->object->getLabel()); |
|
107 | + $this->assertTrue($this->object->isModified()); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | 111 | public function testGetStatus() |
112 | 112 | { |
113 | - $this->assertEquals( 2, $this->object->getStatus() ); |
|
113 | + $this->assertEquals(2, $this->object->getStatus()); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | 117 | public function testSetStatus() |
118 | 118 | { |
119 | - $return = $this->object->setStatus( 0 ); |
|
119 | + $return = $this->object->setStatus(0); |
|
120 | 120 | |
121 | - $this->assertInstanceOf( \Aimeos\MShop\Cms\Item\Iface::class, $return ); |
|
122 | - $this->assertEquals( 0, $this->object->getStatus() ); |
|
123 | - $this->assertTrue( $this->object->isModified() ); |
|
121 | + $this->assertInstanceOf(\Aimeos\MShop\Cms\Item\Iface::class, $return); |
|
122 | + $this->assertEquals(0, $this->object->getStatus()); |
|
123 | + $this->assertTrue($this->object->isModified()); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
127 | 127 | public function testGetTimeModified() |
128 | 128 | { |
129 | - $this->assertEquals( '2011-01-01 00:00:02', $this->object->getTimeModified() ); |
|
129 | + $this->assertEquals('2011-01-01 00:00:02', $this->object->getTimeModified()); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
133 | 133 | public function testGetTimeCreated() |
134 | 134 | { |
135 | - $this->assertEquals( '2011-01-01 00:00:01', $this->object->getTimeCreated() ); |
|
135 | + $this->assertEquals('2011-01-01 00:00:01', $this->object->getTimeCreated()); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
139 | 139 | public function testGetEditor() |
140 | 140 | { |
141 | - $this->assertEquals( 'unitTestUser', $this->object->getEditor() ); |
|
141 | + $this->assertEquals('unitTestUser', $this->object->getEditor()); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
145 | 145 | public function testGetResourceType() |
146 | 146 | { |
147 | - $this->assertEquals( 'cms', $this->object->getResourceType() ); |
|
147 | + $this->assertEquals('cms', $this->object->getResourceType()); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -159,48 +159,48 @@ discard block |
||
159 | 159 | 'cms.status' => 0, |
160 | 160 | ); |
161 | 161 | |
162 | - $item = $item->fromArray( $entries, true ); |
|
162 | + $item = $item->fromArray($entries, true); |
|
163 | 163 | |
164 | - $this->assertEquals( [], $entries ); |
|
165 | - $this->assertEquals( '', $item->getSiteId() ); |
|
166 | - $this->assertEquals( $list['cms.id'], $item->getId() ); |
|
167 | - $this->assertEquals( $list['cms.url'], $item->getUrl() ); |
|
168 | - $this->assertEquals( $list['cms.label'], $item->getLabel() ); |
|
169 | - $this->assertEquals( $list['cms.status'], $item->getStatus() ); |
|
164 | + $this->assertEquals([], $entries); |
|
165 | + $this->assertEquals('', $item->getSiteId()); |
|
166 | + $this->assertEquals($list['cms.id'], $item->getId()); |
|
167 | + $this->assertEquals($list['cms.url'], $item->getUrl()); |
|
168 | + $this->assertEquals($list['cms.label'], $item->getLabel()); |
|
169 | + $this->assertEquals($list['cms.status'], $item->getStatus()); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
173 | 173 | public function testToArray() |
174 | 174 | { |
175 | - $data = $this->object->toArray( true ); |
|
175 | + $data = $this->object->toArray(true); |
|
176 | 176 | |
177 | - $this->assertEquals( count( $this->values ), count( $data ) ); |
|
177 | + $this->assertEquals(count($this->values), count($data)); |
|
178 | 178 | |
179 | - $this->assertEquals( $this->object->getId(), $data['cms.id'] ); |
|
180 | - $this->assertEquals( $this->object->getSiteId(), $data['cms.siteid'] ); |
|
181 | - $this->assertEquals( $this->object->getUrl(), $data['cms.url'] ); |
|
182 | - $this->assertEquals( $this->object->getLabel(), $data['cms.label'] ); |
|
183 | - $this->assertEquals( $this->object->getStatus(), $data['cms.status'] ); |
|
184 | - $this->assertEquals( $this->object->getTimeCreated(), $data['cms.ctime'] ); |
|
185 | - $this->assertEquals( $this->object->getTimeModified(), $data['cms.mtime'] ); |
|
186 | - $this->assertEquals( $this->object->getEditor(), $data['cms.editor'] ); |
|
179 | + $this->assertEquals($this->object->getId(), $data['cms.id']); |
|
180 | + $this->assertEquals($this->object->getSiteId(), $data['cms.siteid']); |
|
181 | + $this->assertEquals($this->object->getUrl(), $data['cms.url']); |
|
182 | + $this->assertEquals($this->object->getLabel(), $data['cms.label']); |
|
183 | + $this->assertEquals($this->object->getStatus(), $data['cms.status']); |
|
184 | + $this->assertEquals($this->object->getTimeCreated(), $data['cms.ctime']); |
|
185 | + $this->assertEquals($this->object->getTimeModified(), $data['cms.mtime']); |
|
186 | + $this->assertEquals($this->object->getEditor(), $data['cms.editor']); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
190 | 190 | public function testIsAvailable() |
191 | 191 | { |
192 | - $this->assertTrue( $this->object->isAvailable() ); |
|
193 | - $this->object->setAvailable( false ); |
|
194 | - $this->assertFalse( $this->object->isAvailable() ); |
|
192 | + $this->assertTrue($this->object->isAvailable()); |
|
193 | + $this->object->setAvailable(false); |
|
194 | + $this->assertFalse($this->object->isAvailable()); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
198 | 198 | public function testIsAvailableOnStatus() |
199 | 199 | { |
200 | - $this->assertTrue( $this->object->isAvailable() ); |
|
201 | - $this->object->setStatus( 0 ); |
|
202 | - $this->assertFalse( $this->object->isAvailable() ); |
|
200 | + $this->assertTrue($this->object->isAvailable()); |
|
201 | + $this->object->setStatus(0); |
|
202 | + $this->assertFalse($this->object->isAvailable()); |
|
203 | 203 | $this->object->setStatus( -1 ); |
204 | - $this->assertFalse( $this->object->isAvailable() ); |
|
204 | + $this->assertFalse($this->object->isAvailable()); |
|
205 | 205 | } |
206 | 206 | } |
@@ -4,17 +4,17 @@ |
||
4 | 4 | * Set error reporting to maximum |
5 | 5 | */ |
6 | 6 | error_reporting( -1 ); |
7 | -ini_set( 'display_errors', true ); |
|
7 | +ini_set('display_errors', true); |
|
8 | 8 | |
9 | -date_default_timezone_set( 'UTC' ); |
|
9 | +date_default_timezone_set('UTC'); |
|
10 | 10 | |
11 | 11 | /* |
12 | 12 | * Set locale settings to reasonable defaults |
13 | 13 | */ |
14 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
15 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
16 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
17 | -setlocale( LC_TIME, 'POSIX' ); |
|
14 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
15 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
16 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
17 | +setlocale(LC_TIME, 'POSIX'); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | require_once 'TestHelper.php'; |
@@ -8,81 +8,81 @@ |
||
8 | 8 | |
9 | 9 | return [ |
10 | 10 | 'table' => [ |
11 | - 'mshop_cms' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
11 | + 'mshop_cms' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
12 | 12 | |
13 | - $table = $schema->createTable( 'mshop_cms' ); |
|
14 | - $table->addOption( 'engine', 'InnoDB' ); |
|
13 | + $table = $schema->createTable('mshop_cms'); |
|
14 | + $table->addOption('engine', 'InnoDB'); |
|
15 | 15 | |
16 | - $table->addColumn( 'id', 'integer', ['autoincrement' => true] ); |
|
17 | - $table->addColumn( 'siteid', 'string', ['length' => 255] ); |
|
18 | - $table->addColumn( 'url', 'string', ['length' => 255] ); |
|
19 | - $table->addColumn( 'label', 'string', ['length' => 255] ); |
|
20 | - $table->addColumn( 'status', 'smallint', [] ); |
|
21 | - $table->addColumn( 'ctime', 'datetime', [] ); |
|
22 | - $table->addColumn( 'mtime', 'datetime', [] ); |
|
23 | - $table->addColumn( 'editor', 'string', ['length' => 255] ); |
|
16 | + $table->addColumn('id', 'integer', ['autoincrement' => true]); |
|
17 | + $table->addColumn('siteid', 'string', ['length' => 255]); |
|
18 | + $table->addColumn('url', 'string', ['length' => 255]); |
|
19 | + $table->addColumn('label', 'string', ['length' => 255]); |
|
20 | + $table->addColumn('status', 'smallint', []); |
|
21 | + $table->addColumn('ctime', 'datetime', []); |
|
22 | + $table->addColumn('mtime', 'datetime', []); |
|
23 | + $table->addColumn('editor', 'string', ['length' => 255]); |
|
24 | 24 | |
25 | - $table->setPrimaryKey( ['id'], 'pk_mscms_id' ); |
|
26 | - $table->addUniqueIndex( ['siteid', 'url'], 'unq_mscms_sid_url' ); |
|
27 | - $table->addIndex( ['siteid', 'status'], 'unq_mscms_sid_status' ); |
|
28 | - $table->addIndex( ['siteid', 'label'], 'unq_mscms_sid_label' ); |
|
25 | + $table->setPrimaryKey(['id'], 'pk_mscms_id'); |
|
26 | + $table->addUniqueIndex(['siteid', 'url'], 'unq_mscms_sid_url'); |
|
27 | + $table->addIndex(['siteid', 'status'], 'unq_mscms_sid_status'); |
|
28 | + $table->addIndex(['siteid', 'label'], 'unq_mscms_sid_label'); |
|
29 | 29 | |
30 | 30 | return $schema; |
31 | 31 | }, |
32 | 32 | |
33 | - 'mshop_cms_list_type' => function( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
33 | + 'mshop_cms_list_type' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
34 | 34 | |
35 | - $table = $schema->createTable( 'mshop_cms_list_type' ); |
|
36 | - $table->addOption( 'engine', 'InnoDB' ); |
|
35 | + $table = $schema->createTable('mshop_cms_list_type'); |
|
36 | + $table->addOption('engine', 'InnoDB'); |
|
37 | 37 | |
38 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
39 | - $table->addColumn( 'siteid', 'string', ['length' => 255] ); |
|
40 | - $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
41 | - $table->addColumn( 'code', 'string', array( 'length' => 64, 'customSchemaOptions' => ['charset' => 'binary'] ) ); |
|
42 | - $table->addColumn( 'label', 'string', array( 'length' => 255 ) ); |
|
43 | - $table->addColumn( 'pos', 'integer', ['default' => 0] ); |
|
44 | - $table->addColumn( 'status', 'smallint', [] ); |
|
45 | - $table->addColumn( 'mtime', 'datetime', [] ); |
|
46 | - $table->addColumn( 'ctime', 'datetime', [] ); |
|
47 | - $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
38 | + $table->addColumn('id', 'integer', array('autoincrement' => true)); |
|
39 | + $table->addColumn('siteid', 'string', ['length' => 255]); |
|
40 | + $table->addColumn('domain', 'string', array('length' => 32)); |
|
41 | + $table->addColumn('code', 'string', array('length' => 64, 'customSchemaOptions' => ['charset' => 'binary'])); |
|
42 | + $table->addColumn('label', 'string', array('length' => 255)); |
|
43 | + $table->addColumn('pos', 'integer', ['default' => 0]); |
|
44 | + $table->addColumn('status', 'smallint', []); |
|
45 | + $table->addColumn('mtime', 'datetime', []); |
|
46 | + $table->addColumn('ctime', 'datetime', []); |
|
47 | + $table->addColumn('editor', 'string', array('length' => 255)); |
|
48 | 48 | |
49 | - $table->setPrimaryKey( array( 'id' ), 'pk_mscmslity_id' ); |
|
50 | - $table->addUniqueIndex( array( 'siteid', 'domain', 'code' ), 'unq_mscmslity_sid_dom_code' ); |
|
51 | - $table->addIndex( array( 'siteid', 'status', 'pos' ), 'idx_mscmslity_sid_status_pos' ); |
|
52 | - $table->addIndex( array( 'siteid', 'label' ), 'idx_mscmslity_sid_label' ); |
|
53 | - $table->addIndex( array( 'siteid', 'code' ), 'idx_mscmslity_sid_code' ); |
|
49 | + $table->setPrimaryKey(array('id'), 'pk_mscmslity_id'); |
|
50 | + $table->addUniqueIndex(array('siteid', 'domain', 'code'), 'unq_mscmslity_sid_dom_code'); |
|
51 | + $table->addIndex(array('siteid', 'status', 'pos'), 'idx_mscmslity_sid_status_pos'); |
|
52 | + $table->addIndex(array('siteid', 'label'), 'idx_mscmslity_sid_label'); |
|
53 | + $table->addIndex(array('siteid', 'code'), 'idx_mscmslity_sid_code'); |
|
54 | 54 | |
55 | 55 | return $schema; |
56 | 56 | }, |
57 | 57 | |
58 | - 'mshop_cms_list' => function( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
59 | - |
|
60 | - $table = $schema->createTable( 'mshop_cms_list' ); |
|
61 | - $table->addOption( 'engine', 'InnoDB' ); |
|
62 | - |
|
63 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
64 | - $table->addColumn( 'parentid', 'integer', [] ); |
|
65 | - $table->addColumn( 'siteid', 'string', ['length' => 255] ); |
|
66 | - $table->addColumn( 'key', 'string', array( 'length' => 134, 'default' => '', 'customSchemaOptions' => ['charset' => 'binary'] ) ); |
|
67 | - $table->addColumn( 'type', 'string', array( 'length' => 64, 'customSchemaOptions' => ['charset' => 'binary'] ) ); |
|
68 | - $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
69 | - $table->addColumn( 'refid', 'string', array( 'length' => 36, 'customSchemaOptions' => ['charset' => 'binary'] ) ); |
|
70 | - $table->addColumn( 'start', 'datetime', array( 'notnull' => false ) ); |
|
71 | - $table->addColumn( 'end', 'datetime', array( 'notnull' => false ) ); |
|
72 | - $table->addColumn( 'config', 'text', array( 'length' => 0xffff ) ); |
|
73 | - $table->addColumn( 'pos', 'integer', [] ); |
|
74 | - $table->addColumn( 'status', 'smallint', [] ); |
|
75 | - $table->addColumn( 'mtime', 'datetime', [] ); |
|
76 | - $table->addColumn( 'ctime', 'datetime', [] ); |
|
77 | - $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
78 | - |
|
79 | - $table->setPrimaryKey( array( 'id' ), 'pk_mscmsli_id' ); |
|
80 | - $table->addUniqueIndex( array( 'parentid', 'siteid', 'domain', 'type', 'refid' ), 'unq_mscmsli_pid_sid_dm_ty_rid' ); |
|
81 | - $table->addIndex( array( 'siteid', 'key' ), 'idx_mscmsli_sid_key' ); |
|
82 | - $table->addIndex( array( 'parentid' ), 'fk_mscmsli_pid' ); |
|
83 | - |
|
84 | - $table->addForeignKeyConstraint( 'mshop_cms', array( 'parentid' ), array( 'id' ), |
|
85 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_mscmsli_pid' ); |
|
58 | + 'mshop_cms_list' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
59 | + |
|
60 | + $table = $schema->createTable('mshop_cms_list'); |
|
61 | + $table->addOption('engine', 'InnoDB'); |
|
62 | + |
|
63 | + $table->addColumn('id', 'integer', array('autoincrement' => true)); |
|
64 | + $table->addColumn('parentid', 'integer', []); |
|
65 | + $table->addColumn('siteid', 'string', ['length' => 255]); |
|
66 | + $table->addColumn('key', 'string', array('length' => 134, 'default' => '', 'customSchemaOptions' => ['charset' => 'binary'])); |
|
67 | + $table->addColumn('type', 'string', array('length' => 64, 'customSchemaOptions' => ['charset' => 'binary'])); |
|
68 | + $table->addColumn('domain', 'string', array('length' => 32)); |
|
69 | + $table->addColumn('refid', 'string', array('length' => 36, 'customSchemaOptions' => ['charset' => 'binary'])); |
|
70 | + $table->addColumn('start', 'datetime', array('notnull' => false)); |
|
71 | + $table->addColumn('end', 'datetime', array('notnull' => false)); |
|
72 | + $table->addColumn('config', 'text', array('length' => 0xffff)); |
|
73 | + $table->addColumn('pos', 'integer', []); |
|
74 | + $table->addColumn('status', 'smallint', []); |
|
75 | + $table->addColumn('mtime', 'datetime', []); |
|
76 | + $table->addColumn('ctime', 'datetime', []); |
|
77 | + $table->addColumn('editor', 'string', array('length' => 255)); |
|
78 | + |
|
79 | + $table->setPrimaryKey(array('id'), 'pk_mscmsli_id'); |
|
80 | + $table->addUniqueIndex(array('parentid', 'siteid', 'domain', 'type', 'refid'), 'unq_mscmsli_pid_sid_dm_ty_rid'); |
|
81 | + $table->addIndex(array('siteid', 'key'), 'idx_mscmsli_sid_key'); |
|
82 | + $table->addIndex(array('parentid'), 'fk_mscmsli_pid'); |
|
83 | + |
|
84 | + $table->addForeignKeyConstraint('mshop_cms', array('parentid'), array('id'), |
|
85 | + array('onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'), 'fk_mscmsli_pid'); |
|
86 | 86 | |
87 | 87 | return $schema; |
88 | 88 | }, |