@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | |
19 | 19 | $includepaths = $aimeos->getIncludePaths(); |
20 | 20 | $includepaths[] = get_include_path(); |
21 | - set_include_path( implode( PATH_SEPARATOR, $includepaths ) ); |
|
21 | + set_include_path(implode(PATH_SEPARATOR, $includepaths)); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | - public static function getContext( $site = 'unittest' ) |
|
25 | + public static function getContext($site = 'unittest') |
|
26 | 26 | { |
27 | - if( !isset( self::$context[$site] ) ) { |
|
28 | - self::$context[$site] = self::createContext( $site ); |
|
27 | + if (!isset(self::$context[$site])) { |
|
28 | + self::$context[$site] = self::createContext($site); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | return clone self::$context[$site]; |
@@ -34,58 +34,58 @@ discard block |
||
34 | 34 | |
35 | 35 | private static function getAimeos() |
36 | 36 | { |
37 | - if( !isset( self::$aimeos ) ) |
|
37 | + if (!isset(self::$aimeos)) |
|
38 | 38 | { |
39 | 39 | require_once 'Bootstrap.php'; |
40 | - spl_autoload_register( '\Aimeos\Bootstrap::autoload' ); |
|
40 | + spl_autoload_register('\Aimeos\Bootstrap::autoload'); |
|
41 | 41 | |
42 | - $extdir = dirname( dirname( dirname( __DIR__ ) ) ); |
|
43 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false ); |
|
42 | + $extdir = dirname(dirname(dirname(__DIR__))); |
|
43 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return self::$aimeos; |
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | - private static function createContext( $site ) |
|
50 | + private static function createContext($site) |
|
51 | 51 | { |
52 | 52 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
53 | 53 | $aimeos = self::getAimeos(); |
54 | 54 | |
55 | 55 | |
56 | - $paths = $aimeos->getConfigPaths( 'mysql' ); |
|
57 | - $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
|
56 | + $paths = $aimeos->getConfigPaths('mysql'); |
|
57 | + $paths[] = __DIR__.DIRECTORY_SEPARATOR.'config'; |
|
58 | 58 | |
59 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
60 | - $ctx->setConfig( $conf ); |
|
59 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
60 | + $ctx->setConfig($conf); |
|
61 | 61 | |
62 | 62 | |
63 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
64 | - $ctx->setDatabaseManager( $dbm ); |
|
63 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
64 | + $ctx->setDatabaseManager($dbm); |
|
65 | 65 | |
66 | 66 | |
67 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
68 | - $ctx->setLogger( $logger ); |
|
67 | + $logger = new \Aimeos\MW\Logger\File($site.'.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
68 | + $ctx->setLogger($logger); |
|
69 | 69 | |
70 | 70 | |
71 | 71 | $cache = new \Aimeos\MW\Cache\None(); |
72 | - $ctx->setCache( $cache ); |
|
72 | + $ctx->setCache($cache); |
|
73 | 73 | |
74 | 74 | |
75 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
76 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
75 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
76 | + $ctx->setI18n(array('de' => $i18n)); |
|
77 | 77 | |
78 | 78 | |
79 | 79 | $session = new \Aimeos\MW\Session\None(); |
80 | - $ctx->setSession( $session ); |
|
80 | + $ctx->setSession($session); |
|
81 | 81 | |
82 | 82 | |
83 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
84 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
83 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
84 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
85 | 85 | |
86 | - $ctx->setLocale( $localeItem ); |
|
86 | + $ctx->setLocale($localeItem); |
|
87 | 87 | |
88 | - $ctx->setEditor( 'ai-filesystem:unittest' ); |
|
88 | + $ctx->setEditor('ai-filesystem:unittest'); |
|
89 | 89 | |
90 | 90 | return $ctx; |
91 | 91 | } |
@@ -11,394 +11,394 @@ |
||
11 | 11 | |
12 | 12 | protected function setUp() |
13 | 13 | { |
14 | - if( !interface_exists( '\\League\\Flysystem\\FilesystemInterface' ) ) { |
|
15 | - $this->markTestSkipped( 'Install Flysystem first' ); |
|
14 | + if (!interface_exists('\\League\\Flysystem\\FilesystemInterface')) { |
|
15 | + $this->markTestSkipped('Install Flysystem first'); |
|
16 | 16 | } |
17 | 17 | |
18 | - $this->object = $this->getMockBuilder( '\\Aimeos\\MW\\Filesystem\\FlyNone' ) |
|
19 | - ->setConstructorArgs( array( array( 'adapter' => 'FlyNone' ) ) ) |
|
20 | - ->setMethods( array( 'getProvider' ) ) |
|
18 | + $this->object = $this->getMockBuilder('\\Aimeos\\MW\\Filesystem\\FlyNone') |
|
19 | + ->setConstructorArgs(array(array('adapter' => 'FlyNone'))) |
|
20 | + ->setMethods(array('getProvider')) |
|
21 | 21 | ->getMock(); |
22 | 22 | |
23 | - $this->mock = $this->getMockBuilder( '\\League\\Flysystem\\FilesystemInterface' ) |
|
23 | + $this->mock = $this->getMockBuilder('\\League\\Flysystem\\FilesystemInterface') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object->expects( $this->once() )->method( 'getProvider' ) |
|
28 | - ->will( $this->returnValue( $this->mock ) ); |
|
27 | + $this->object->expects($this->once())->method('getProvider') |
|
28 | + ->will($this->returnValue($this->mock)); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | protected function tearDown() |
33 | 33 | { |
34 | - unset( $this->object, $this->mock ); |
|
34 | + unset($this->object, $this->mock); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testIsdir() |
39 | 39 | { |
40 | - $this->mock->expects( $this->once() )->method( 'getMetadata' ) |
|
41 | - ->will( $this->returnValue( array( 'type' => 'dir' ) ) ); |
|
40 | + $this->mock->expects($this->once())->method('getMetadata') |
|
41 | + ->will($this->returnValue(array('type' => 'dir'))); |
|
42 | 42 | |
43 | - $this->assertTrue( $this->object->isdir( 'test' ) ); |
|
43 | + $this->assertTrue($this->object->isdir('test')); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | public function testIsdirFalse() |
48 | 48 | { |
49 | - $this->mock->expects( $this->once() )->method( 'getMetadata' ) |
|
50 | - ->will( $this->returnValue( array( 'type' => 'file' ) ) ); |
|
49 | + $this->mock->expects($this->once())->method('getMetadata') |
|
50 | + ->will($this->returnValue(array('type' => 'file'))); |
|
51 | 51 | |
52 | - $this->assertFalse( $this->object->isdir( 'test' ) ); |
|
52 | + $this->assertFalse($this->object->isdir('test')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | public function testMkdir() |
57 | 57 | { |
58 | - $this->mock->expects( $this->once() )->method( 'createDir' ) |
|
59 | - ->will( $this->returnValue( true ) ); |
|
58 | + $this->mock->expects($this->once())->method('createDir') |
|
59 | + ->will($this->returnValue(true)); |
|
60 | 60 | |
61 | - $this->object->mkdir( 'test' ); |
|
61 | + $this->object->mkdir('test'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | public function testMkdirException() |
66 | 66 | { |
67 | - $this->mock->expects( $this->once() )->method( 'createDir' ) |
|
68 | - ->will( $this->returnValue( false ) ); |
|
67 | + $this->mock->expects($this->once())->method('createDir') |
|
68 | + ->will($this->returnValue(false)); |
|
69 | 69 | |
70 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
71 | - $this->object->mkdir( 'test' ); |
|
70 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
71 | + $this->object->mkdir('test'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | public function testRmdir() |
76 | 76 | { |
77 | - $this->mock->expects( $this->once() )->method( 'deleteDir' ) |
|
78 | - ->will( $this->returnValue( true ) ); |
|
77 | + $this->mock->expects($this->once())->method('deleteDir') |
|
78 | + ->will($this->returnValue(true)); |
|
79 | 79 | |
80 | - $this->object->rmdir( 'test' ); |
|
80 | + $this->object->rmdir('test'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | 84 | public function testRmdirException() |
85 | 85 | { |
86 | - $this->mock->expects( $this->once() )->method( 'deleteDir' ) |
|
87 | - ->will( $this->returnValue( false ) ); |
|
86 | + $this->mock->expects($this->once())->method('deleteDir') |
|
87 | + ->will($this->returnValue(false)); |
|
88 | 88 | |
89 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
90 | - $this->object->rmdir( 'test' ); |
|
89 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
90 | + $this->object->rmdir('test'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
94 | 94 | public function testScan() |
95 | 95 | { |
96 | - $this->mock->expects( $this->once() )->method( 'listContents' ) |
|
97 | - ->will( $this->returnValue( array( array( 'basename' => 'test' ) ) ) ); |
|
96 | + $this->mock->expects($this->once())->method('listContents') |
|
97 | + ->will($this->returnValue(array(array('basename' => 'test')))); |
|
98 | 98 | |
99 | - $this->assertEquals( array( 'test' ), $this->object->scan() ); |
|
99 | + $this->assertEquals(array('test'), $this->object->scan()); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
103 | 103 | public function testSize() |
104 | 104 | { |
105 | - $this->mock->expects( $this->once() )->method( 'getSize' ) |
|
106 | - ->will( $this->returnValue( 4 ) ); |
|
105 | + $this->mock->expects($this->once())->method('getSize') |
|
106 | + ->will($this->returnValue(4)); |
|
107 | 107 | |
108 | - $this->assertEquals( 4, $this->object->size( 'test' ) ); |
|
108 | + $this->assertEquals(4, $this->object->size('test')); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
112 | 112 | public function testSizeException() |
113 | 113 | { |
114 | - $this->mock->expects( $this->once() )->method( 'getSize' ) |
|
115 | - ->will( $this->returnValue( false ) ); |
|
114 | + $this->mock->expects($this->once())->method('getSize') |
|
115 | + ->will($this->returnValue(false)); |
|
116 | 116 | |
117 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
118 | - $this->object->size( 'test' ); |
|
117 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
118 | + $this->object->size('test'); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
122 | 122 | public function testSizeException2() |
123 | 123 | { |
124 | - $this->mock->expects( $this->once() )->method( 'getSize' ) |
|
125 | - ->will( $this->throwException( new \Exception() ) ); |
|
124 | + $this->mock->expects($this->once())->method('getSize') |
|
125 | + ->will($this->throwException(new \Exception())); |
|
126 | 126 | |
127 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
128 | - $this->object->size( 'test' ); |
|
127 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
128 | + $this->object->size('test'); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | public function testTime() |
133 | 133 | { |
134 | - $this->mock->expects( $this->once() )->method( 'getTimestamp' ) |
|
135 | - ->will( $this->returnValue( 4 ) ); |
|
134 | + $this->mock->expects($this->once())->method('getTimestamp') |
|
135 | + ->will($this->returnValue(4)); |
|
136 | 136 | |
137 | - $this->assertEquals( 4, $this->object->time( 'test' ) ); |
|
137 | + $this->assertEquals(4, $this->object->time('test')); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
141 | 141 | public function testTimeException() |
142 | 142 | { |
143 | - $this->mock->expects( $this->once() )->method( 'getTimestamp' ) |
|
144 | - ->will( $this->returnValue( false ) ); |
|
143 | + $this->mock->expects($this->once())->method('getTimestamp') |
|
144 | + ->will($this->returnValue(false)); |
|
145 | 145 | |
146 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
147 | - $this->object->time( 'test' ); |
|
146 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
147 | + $this->object->time('test'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
151 | 151 | public function testTimeException2() |
152 | 152 | { |
153 | - $this->mock->expects( $this->once() )->method( 'getTimestamp' ) |
|
154 | - ->will( $this->throwException( new \Exception() ) ); |
|
153 | + $this->mock->expects($this->once())->method('getTimestamp') |
|
154 | + ->will($this->throwException(new \Exception())); |
|
155 | 155 | |
156 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
157 | - $this->object->time( 'test' ); |
|
156 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
157 | + $this->object->time('test'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | 161 | public function testRm() |
162 | 162 | { |
163 | - $this->mock->expects( $this->once() )->method( 'delete' ) |
|
164 | - ->will( $this->returnValue( 4 ) ); |
|
163 | + $this->mock->expects($this->once())->method('delete') |
|
164 | + ->will($this->returnValue(4)); |
|
165 | 165 | |
166 | - $this->object->rm( 'test' ); |
|
166 | + $this->object->rm('test'); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
170 | 170 | public function testRmException() |
171 | 171 | { |
172 | - $this->mock->expects( $this->once() )->method( 'delete' ) |
|
173 | - ->will( $this->throwException( new \Exception() ) ); |
|
172 | + $this->mock->expects($this->once())->method('delete') |
|
173 | + ->will($this->throwException(new \Exception())); |
|
174 | 174 | |
175 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
176 | - $this->object->rm( 'test' ); |
|
175 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
176 | + $this->object->rm('test'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
180 | 180 | public function testHas() |
181 | 181 | { |
182 | - $this->mock->expects( $this->once() )->method( 'has' ) |
|
183 | - ->will( $this->returnValue( true ) ); |
|
182 | + $this->mock->expects($this->once())->method('has') |
|
183 | + ->will($this->returnValue(true)); |
|
184 | 184 | |
185 | - $result = $this->object->has( 'test' ); |
|
185 | + $result = $this->object->has('test'); |
|
186 | 186 | |
187 | - $this->assertTrue( $result ); |
|
187 | + $this->assertTrue($result); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
191 | 191 | public function testHasFalse() |
192 | 192 | { |
193 | - $this->mock->expects( $this->once() )->method( 'has' ) |
|
194 | - ->will( $this->returnValue( false ) ); |
|
193 | + $this->mock->expects($this->once())->method('has') |
|
194 | + ->will($this->returnValue(false)); |
|
195 | 195 | |
196 | - $result = $this->object->has( 'test' ); |
|
196 | + $result = $this->object->has('test'); |
|
197 | 197 | |
198 | - $this->assertFalse( $result ); |
|
198 | + $this->assertFalse($result); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | 202 | public function testRead() |
203 | 203 | { |
204 | - $this->mock->expects( $this->once() )->method( 'read' ) |
|
205 | - ->will( $this->returnValue( 'value' ) ); |
|
204 | + $this->mock->expects($this->once())->method('read') |
|
205 | + ->will($this->returnValue('value')); |
|
206 | 206 | |
207 | - $this->assertEquals( 'value', $this->object->read( 'test' ) ); |
|
207 | + $this->assertEquals('value', $this->object->read('test')); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
211 | 211 | public function testReadException() |
212 | 212 | { |
213 | - $this->mock->expects( $this->once() )->method( 'read' ) |
|
214 | - ->will( $this->returnValue( false ) ); |
|
213 | + $this->mock->expects($this->once())->method('read') |
|
214 | + ->will($this->returnValue(false)); |
|
215 | 215 | |
216 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
217 | - $this->object->read( 'test' ); |
|
216 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
217 | + $this->object->read('test'); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | |
221 | 221 | public function testReadException2() |
222 | 222 | { |
223 | - $this->mock->expects( $this->once() )->method( 'read' ) |
|
224 | - ->will( $this->throwException( new \Exception() ) ); |
|
223 | + $this->mock->expects($this->once())->method('read') |
|
224 | + ->will($this->throwException(new \Exception())); |
|
225 | 225 | |
226 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
227 | - $this->object->read( 'test' ); |
|
226 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
227 | + $this->object->read('test'); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | |
231 | 231 | public function testReadf() |
232 | 232 | { |
233 | - $file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'flytest'; |
|
234 | - file_put_contents( $file, 'test' ); |
|
233 | + $file = sys_get_temp_dir().DIRECTORY_SEPARATOR.'flytest'; |
|
234 | + file_put_contents($file, 'test'); |
|
235 | 235 | |
236 | - $this->mock->expects( $this->once() )->method( 'readStream' ) |
|
237 | - ->will( $this->returnValue( fopen( $file, 'r' ) ) ); |
|
236 | + $this->mock->expects($this->once())->method('readStream') |
|
237 | + ->will($this->returnValue(fopen($file, 'r'))); |
|
238 | 238 | |
239 | - $result = $this->object->readf( 'file' ); |
|
239 | + $result = $this->object->readf('file'); |
|
240 | 240 | |
241 | - $this->assertEquals( 'test', file_get_contents( $result ) ); |
|
241 | + $this->assertEquals('test', file_get_contents($result)); |
|
242 | 242 | |
243 | - unlink( $result ); |
|
244 | - unlink( $file ); |
|
243 | + unlink($result); |
|
244 | + unlink($file); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | |
248 | 248 | public function testReads() |
249 | 249 | { |
250 | - $this->mock->expects( $this->once() )->method( 'readStream' ) |
|
251 | - ->will( $this->returnValue( 1 ) ); |
|
250 | + $this->mock->expects($this->once())->method('readStream') |
|
251 | + ->will($this->returnValue(1)); |
|
252 | 252 | |
253 | - $this->assertEquals( 1, $this->object->reads( 'test' ) ); |
|
253 | + $this->assertEquals(1, $this->object->reads('test')); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | |
257 | 257 | public function testReadsException() |
258 | 258 | { |
259 | - $this->mock->expects( $this->once() )->method( 'readStream' ) |
|
260 | - ->will( $this->returnValue( false ) ); |
|
259 | + $this->mock->expects($this->once())->method('readStream') |
|
260 | + ->will($this->returnValue(false)); |
|
261 | 261 | |
262 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
263 | - $this->object->reads( 'test' ); |
|
262 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
263 | + $this->object->reads('test'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
267 | 267 | public function testReadsException2() |
268 | 268 | { |
269 | - $this->mock->expects( $this->once() )->method( 'readStream' ) |
|
270 | - ->will( $this->throwException( new \Exception() ) ); |
|
269 | + $this->mock->expects($this->once())->method('readStream') |
|
270 | + ->will($this->throwException(new \Exception())); |
|
271 | 271 | |
272 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
273 | - $this->object->reads( 'test' ); |
|
272 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
273 | + $this->object->reads('test'); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
277 | 277 | public function testWrite() |
278 | 278 | { |
279 | - $this->mock->expects( $this->once() )->method( 'put' ) |
|
280 | - ->will( $this->returnValue( true ) ); |
|
279 | + $this->mock->expects($this->once())->method('put') |
|
280 | + ->will($this->returnValue(true)); |
|
281 | 281 | |
282 | - $this->object->write( 'test', 'value' ); |
|
282 | + $this->object->write('test', 'value'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
286 | 286 | public function testWriteException() |
287 | 287 | { |
288 | - $this->mock->expects( $this->once() )->method( 'put' ) |
|
289 | - ->will( $this->returnValue( false ) ); |
|
288 | + $this->mock->expects($this->once())->method('put') |
|
289 | + ->will($this->returnValue(false)); |
|
290 | 290 | |
291 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
292 | - $this->object->write( 'test', 'value' ); |
|
291 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
292 | + $this->object->write('test', 'value'); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | |
296 | 296 | public function testWriteException2() |
297 | 297 | { |
298 | - $this->mock->expects( $this->once() )->method( 'put' ) |
|
299 | - ->will( $this->throwException( new \Exception() ) ); |
|
298 | + $this->mock->expects($this->once())->method('put') |
|
299 | + ->will($this->throwException(new \Exception())); |
|
300 | 300 | |
301 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
302 | - $this->object->write( 'test', 'value' ); |
|
301 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
302 | + $this->object->write('test', 'value'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
306 | 306 | public function testWritef() |
307 | 307 | { |
308 | - $file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'flytest'; |
|
309 | - file_put_contents( $file, 'test' ); |
|
308 | + $file = sys_get_temp_dir().DIRECTORY_SEPARATOR.'flytest'; |
|
309 | + file_put_contents($file, 'test'); |
|
310 | 310 | |
311 | - $this->mock->expects( $this->once() )->method( 'putStream' ); |
|
311 | + $this->mock->expects($this->once())->method('putStream'); |
|
312 | 312 | |
313 | - $this->object->writef( 'file', $file ); |
|
313 | + $this->object->writef('file', $file); |
|
314 | 314 | |
315 | - unlink( $file ); |
|
315 | + unlink($file); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
319 | 319 | public function testWrites() |
320 | 320 | { |
321 | - $this->mock->expects( $this->once() )->method( 'putStream' ) |
|
322 | - ->will( $this->returnValue( true ) ); |
|
321 | + $this->mock->expects($this->once())->method('putStream') |
|
322 | + ->will($this->returnValue(true)); |
|
323 | 323 | |
324 | - $this->object->writes( 'test', 1 ); |
|
324 | + $this->object->writes('test', 1); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
328 | 328 | public function testWritesException() |
329 | 329 | { |
330 | - $this->mock->expects( $this->once() )->method( 'putStream' ) |
|
331 | - ->will( $this->returnValue( false ) ); |
|
330 | + $this->mock->expects($this->once())->method('putStream') |
|
331 | + ->will($this->returnValue(false)); |
|
332 | 332 | |
333 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
334 | - $this->object->writes( 'test', 2 ); |
|
333 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
334 | + $this->object->writes('test', 2); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
338 | 338 | public function testWritesException2() |
339 | 339 | { |
340 | - $this->mock->expects( $this->once() )->method( 'putStream' ) |
|
341 | - ->will( $this->throwException( new \Exception() ) ); |
|
340 | + $this->mock->expects($this->once())->method('putStream') |
|
341 | + ->will($this->throwException(new \Exception())); |
|
342 | 342 | |
343 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
344 | - $this->object->writes( 'test', null ); |
|
343 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
344 | + $this->object->writes('test', null); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
348 | 348 | public function testMove() |
349 | 349 | { |
350 | - $this->mock->expects( $this->once() )->method( 'rename' ) |
|
351 | - ->will( $this->returnValue( true ) ); |
|
350 | + $this->mock->expects($this->once())->method('rename') |
|
351 | + ->will($this->returnValue(true)); |
|
352 | 352 | |
353 | - $this->object->move( 'file1', 'file2' ); |
|
353 | + $this->object->move('file1', 'file2'); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | |
357 | 357 | public function testMoveException() |
358 | 358 | { |
359 | - $this->mock->expects( $this->once() )->method( 'rename' ) |
|
360 | - ->will( $this->returnValue( false ) ); |
|
359 | + $this->mock->expects($this->once())->method('rename') |
|
360 | + ->will($this->returnValue(false)); |
|
361 | 361 | |
362 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
363 | - $this->object->move( 'file1', 'file2' ); |
|
362 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
363 | + $this->object->move('file1', 'file2'); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | |
367 | 367 | public function testMoveException2() |
368 | 368 | { |
369 | - $this->mock->expects( $this->once() )->method( 'rename' ) |
|
370 | - ->will( $this->throwException( new \Exception() ) ); |
|
369 | + $this->mock->expects($this->once())->method('rename') |
|
370 | + ->will($this->throwException(new \Exception())); |
|
371 | 371 | |
372 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
373 | - $this->object->move( 'file1', 'file2' ); |
|
372 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
373 | + $this->object->move('file1', 'file2'); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | |
377 | 377 | public function testCopy() |
378 | 378 | { |
379 | - $this->mock->expects( $this->once() )->method( 'copy' ) |
|
380 | - ->will( $this->returnValue( true ) ); |
|
379 | + $this->mock->expects($this->once())->method('copy') |
|
380 | + ->will($this->returnValue(true)); |
|
381 | 381 | |
382 | - $this->object->copy( 'file1', 'file2' ); |
|
382 | + $this->object->copy('file1', 'file2'); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | |
386 | 386 | public function testCopyException() |
387 | 387 | { |
388 | - $this->mock->expects( $this->once() )->method( 'copy' ) |
|
389 | - ->will( $this->returnValue( false ) ); |
|
388 | + $this->mock->expects($this->once())->method('copy') |
|
389 | + ->will($this->returnValue(false)); |
|
390 | 390 | |
391 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
392 | - $this->object->copy( 'file1', 'file2' ); |
|
391 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
392 | + $this->object->copy('file1', 'file2'); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
396 | 396 | public function testCopyException2() |
397 | 397 | { |
398 | - $this->mock->expects( $this->once() )->method( 'copy' ) |
|
399 | - ->will( $this->throwException( new \Exception() ) ); |
|
398 | + $this->mock->expects($this->once())->method('copy') |
|
399 | + ->will($this->throwException(new \Exception())); |
|
400 | 400 | |
401 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
402 | - $this->object->copy( 'file1', 'file2' ); |
|
401 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
402 | + $this->object->copy('file1', 'file2'); |
|
403 | 403 | } |
404 | 404 | } |
@@ -7,42 +7,42 @@ |
||
7 | 7 | { |
8 | 8 | protected function setUp() |
9 | 9 | { |
10 | - if( !interface_exists( '\\League\\Flysystem\\FilesystemInterface' ) ) { |
|
11 | - $this->markTestSkipped( 'Install Flysystem first' ); |
|
10 | + if (!interface_exists('\\League\\Flysystem\\FilesystemInterface')) { |
|
11 | + $this->markTestSkipped('Install Flysystem first'); |
|
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
15 | 15 | |
16 | 16 | public function testGetProvider() |
17 | 17 | { |
18 | - if( !class_exists( '\League\Flysystem\WebDAV\WebDAVAdapter' ) ) { |
|
19 | - $this->markTestSkipped( 'Install Flysystem WebDAV adapter' ); |
|
18 | + if (!class_exists('\League\Flysystem\WebDAV\WebDAVAdapter')) { |
|
19 | + $this->markTestSkipped('Install Flysystem WebDAV adapter'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | try |
23 | 23 | { |
24 | - $object = new FlyWebdav( array( 'baseUri' => 'http://test.webdav.org/dav/' ) ); |
|
25 | - $this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object ); |
|
24 | + $object = new FlyWebdav(array('baseUri' => 'http://test.webdav.org/dav/')); |
|
25 | + $this->assertInstanceof('\Aimeos\MW\Filesystem\Iface', $object); |
|
26 | 26 | |
27 | - $object->has( 'test' ); |
|
27 | + $object->has('test'); |
|
28 | 28 | } |
29 | - catch( \Exception $e ) |
|
29 | + catch (\Exception $e) |
|
30 | 30 | { |
31 | - $this->markTestSkipped( $e->getMessage() ); |
|
31 | + $this->markTestSkipped($e->getMessage()); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testGetProviderNoBaseuri() |
37 | 37 | { |
38 | - if( !class_exists( '\League\Flysystem\WebDAV\WebDAVAdapter' ) ) { |
|
39 | - $this->markTestSkipped( 'Install Flysystem WebDAV adapter' ); |
|
38 | + if (!class_exists('\League\Flysystem\WebDAV\WebDAVAdapter')) { |
|
39 | + $this->markTestSkipped('Install Flysystem WebDAV adapter'); |
|
40 | 40 | } |
41 | 41 | |
42 | - $object = new FlyWebdav( array() ); |
|
43 | - $this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object ); |
|
42 | + $object = new FlyWebdav(array()); |
|
43 | + $this->assertInstanceof('\Aimeos\MW\Filesystem\Iface', $object); |
|
44 | 44 | |
45 | - $this->setExpectedException( '\InvalidArgumentException' ); |
|
46 | - $object->has( 'test' ); |
|
45 | + $this->setExpectedException('\InvalidArgumentException'); |
|
46 | + $object->has('test'); |
|
47 | 47 | } |
48 | 48 | } |
@@ -25,8 +25,7 @@ |
||
25 | 25 | $this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object ); |
26 | 26 | |
27 | 27 | $object->has( 'test' ); |
28 | - } |
|
29 | - catch( \Exception $e ) |
|
28 | + } catch( \Exception $e ) |
|
30 | 29 | { |
31 | 30 | $this->markTestSkipped( $e->getMessage() ); |
32 | 31 | } |