@@ -25,7 +25,6 @@ |
||
| 25 | 25 | /** |
| 26 | 26 | * Initializes the object |
| 27 | 27 | * |
| 28 | - * @param string $basepath Root path to the file system |
|
| 29 | 28 | */ |
| 30 | 29 | public function __construct( \Illuminate\Contracts\Filesystem\Filesystem $fs ) |
| 31 | 30 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param string $path Path to the directory |
| 53 | 53 | * @return void |
| 54 | 54 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 55 | - */ |
|
| 55 | + */ |
|
| 56 | 56 | public function mkdir( $path ) |
| 57 | 57 | { |
| 58 | 58 | try { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param string $path Path to the directory |
| 70 | 70 | * @return void |
| 71 | 71 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 72 | - */ |
|
| 72 | + */ |
|
| 73 | 73 | public function rmdir( $path ) |
| 74 | 74 | { |
| 75 | 75 | try { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param string $basepath Root path to the file system |
| 29 | 29 | */ |
| 30 | - public function __construct( \Illuminate\Contracts\Filesystem\Filesystem $fs ) |
|
| 30 | + public function __construct(\Illuminate\Contracts\Filesystem\Filesystem $fs) |
|
| 31 | 31 | { |
| 32 | 32 | $this->fs = $fs; |
| 33 | 33 | } |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | * @return boolean True if directory, false if not |
| 41 | 41 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 42 | 42 | */ |
| 43 | - public function isdir( $path ) |
|
| 43 | + public function isdir($path) |
|
| 44 | 44 | { |
| 45 | - return in_array( basename( $path ), $this->fs->directories( dirname( $path ) ) ); |
|
| 45 | + return in_array(basename($path), $this->fs->directories(dirname($path))); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | * @return void |
| 54 | 54 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 55 | 55 | */ |
| 56 | - public function mkdir( $path ) |
|
| 56 | + public function mkdir($path) |
|
| 57 | 57 | { |
| 58 | 58 | try { |
| 59 | - $this->fs->makeDirectory( $path ); |
|
| 60 | - } catch( \Exception $e ) { |
|
| 61 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 59 | + $this->fs->makeDirectory($path); |
|
| 60 | + } catch (\Exception $e) { |
|
| 61 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | * @return void |
| 71 | 71 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 72 | 72 | */ |
| 73 | - public function rmdir( $path ) |
|
| 73 | + public function rmdir($path) |
|
| 74 | 74 | { |
| 75 | 75 | try { |
| 76 | - $this->fs->deleteDirectory( $path ); |
|
| 77 | - } catch( \Exception $e ) { |
|
| 78 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 76 | + $this->fs->deleteDirectory($path); |
|
| 77 | + } catch (\Exception $e) { |
|
| 78 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | * @return \Iterator|array Iterator over the entries or array with entries |
| 90 | 90 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 91 | 91 | */ |
| 92 | - public function scan( $path = null ) |
|
| 92 | + public function scan($path = null) |
|
| 93 | 93 | { |
| 94 | 94 | try { |
| 95 | - return array_merge( $this->fs->directories( $path ), $this->fs->files( $path ) ); |
|
| 96 | - } catch( \Exception $e ) { |
|
| 97 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 95 | + return array_merge($this->fs->directories($path), $this->fs->files($path)); |
|
| 96 | + } catch (\Exception $e) { |
|
| 97 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -106,12 +106,12 @@ discard block |
||
| 106 | 106 | * @return integer Size in bytes |
| 107 | 107 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 108 | 108 | */ |
| 109 | - public function size( $path ) |
|
| 109 | + public function size($path) |
|
| 110 | 110 | { |
| 111 | 111 | try { |
| 112 | - return $this->fs->size( $path ); |
|
| 113 | - } catch( \Exception $e ) { |
|
| 114 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 112 | + return $this->fs->size($path); |
|
| 113 | + } catch (\Exception $e) { |
|
| 114 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
@@ -123,12 +123,12 @@ discard block |
||
| 123 | 123 | * @return integer Unix time stamp in seconds |
| 124 | 124 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 125 | 125 | */ |
| 126 | - public function time( $path ) |
|
| 126 | + public function time($path) |
|
| 127 | 127 | { |
| 128 | 128 | try { |
| 129 | - return $this->fs->lastModified( $path ); |
|
| 130 | - } catch( \Exception $e ) { |
|
| 131 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 129 | + return $this->fs->lastModified($path); |
|
| 130 | + } catch (\Exception $e) { |
|
| 131 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
@@ -140,12 +140,12 @@ discard block |
||
| 140 | 140 | * @return void |
| 141 | 141 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 142 | 142 | */ |
| 143 | - public function rm( $path ) |
|
| 143 | + public function rm($path) |
|
| 144 | 144 | { |
| 145 | 145 | try { |
| 146 | - $this->fs->delete( $path ); |
|
| 147 | - } catch( \Exception $e ) { |
|
| 148 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 146 | + $this->fs->delete($path); |
|
| 147 | + } catch (\Exception $e) { |
|
| 148 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -156,9 +156,9 @@ discard block |
||
| 156 | 156 | * @param string $path Path to the file |
| 157 | 157 | * @return boolean True if it exists, false if not |
| 158 | 158 | */ |
| 159 | - public function has( $path ) |
|
| 159 | + public function has($path) |
|
| 160 | 160 | { |
| 161 | - return $this->fs->exists( $path ); |
|
| 161 | + return $this->fs->exists($path); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
@@ -171,12 +171,12 @@ discard block |
||
| 171 | 171 | * @return string File content |
| 172 | 172 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 173 | 173 | */ |
| 174 | - public function read( $path ) |
|
| 174 | + public function read($path) |
|
| 175 | 175 | { |
| 176 | 176 | try { |
| 177 | - return $this->fs->get( $path ); |
|
| 178 | - } catch( \Exception $e ) { |
|
| 179 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 177 | + return $this->fs->get($path); |
|
| 178 | + } catch (\Exception $e) { |
|
| 179 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
@@ -190,27 +190,27 @@ discard block |
||
| 190 | 190 | * @return resource File stream descriptor |
| 191 | 191 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 192 | 192 | */ |
| 193 | - public function reads( $path ) |
|
| 193 | + public function reads($path) |
|
| 194 | 194 | { |
| 195 | 195 | try { |
| 196 | - $content = $this->fs->get( $path ); |
|
| 197 | - } catch( \Exception $e ) { |
|
| 198 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 196 | + $content = $this->fs->get($path); |
|
| 197 | + } catch (\Exception $e) { |
|
| 198 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - if( ( $stream = tmpfile() ) === false ) { |
|
| 201 | + if (($stream = tmpfile()) === false) { |
|
| 202 | 202 | $error = error_get_last(); |
| 203 | - throw new Exception( $error['message'] ); |
|
| 203 | + throw new Exception($error['message']); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if( fwrite( $stream, $content ) === false ) { |
|
| 206 | + if (fwrite($stream, $content) === false) { |
|
| 207 | 207 | $error = error_get_last(); |
| 208 | - throw new Exception( $error['message'] ); |
|
| 208 | + throw new Exception($error['message']); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if( rewind( $stream ) === false ) { |
|
| 211 | + if (rewind($stream) === false) { |
|
| 212 | 212 | $error = error_get_last(); |
| 213 | - throw new Exception( $error['message'] ); |
|
| 213 | + throw new Exception($error['message']); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | return $stream; |
@@ -227,12 +227,12 @@ discard block |
||
| 227 | 227 | * @return void |
| 228 | 228 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 229 | 229 | */ |
| 230 | - public function write( $path, $content ) |
|
| 230 | + public function write($path, $content) |
|
| 231 | 231 | { |
| 232 | 232 | try { |
| 233 | - $this->fs->put( $path, $content ); |
|
| 234 | - } catch( \Exception $e ) { |
|
| 235 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 233 | + $this->fs->put($path, $content); |
|
| 234 | + } catch (\Exception $e) { |
|
| 235 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
@@ -247,17 +247,17 @@ discard block |
||
| 247 | 247 | * @return void |
| 248 | 248 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 249 | 249 | */ |
| 250 | - public function writes( $path, $stream ) |
|
| 250 | + public function writes($path, $stream) |
|
| 251 | 251 | { |
| 252 | - if( ( $content = @fread( $stream, 0x7fffffff ) ) === false ) { |
|
| 252 | + if (($content = @fread($stream, 0x7fffffff)) === false) { |
|
| 253 | 253 | $error = error_get_last(); |
| 254 | - throw new Exception( $error['message'] ); |
|
| 254 | + throw new Exception($error['message']); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | try { |
| 258 | - $content = $this->fs->put( $path, $content ); |
|
| 259 | - } catch( \Exception $e ) { |
|
| 260 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 258 | + $content = $this->fs->put($path, $content); |
|
| 259 | + } catch (\Exception $e) { |
|
| 260 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | * @return void |
| 271 | 271 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 272 | 272 | */ |
| 273 | - public function move( $from, $to ) |
|
| 273 | + public function move($from, $to) |
|
| 274 | 274 | { |
| 275 | 275 | try { |
| 276 | - $this->fs->move( $from, $to ); |
|
| 277 | - } catch( \Exception $e ) { |
|
| 278 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 276 | + $this->fs->move($from, $to); |
|
| 277 | + } catch (\Exception $e) { |
|
| 278 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
@@ -288,12 +288,12 @@ discard block |
||
| 288 | 288 | * @return void |
| 289 | 289 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
| 290 | 290 | */ |
| 291 | - public function copy( $from, $to ) |
|
| 291 | + public function copy($from, $to) |
|
| 292 | 292 | { |
| 293 | 293 | try { |
| 294 | - $this->fs->copy( $from, $to ); |
|
| 295 | - } catch( \Exception $e ) { |
|
| 296 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
| 294 | + $this->fs->copy($from, $to); |
|
| 295 | + } catch (\Exception $e) { |
|
| 296 | + throw new Exception($e->getMessage(), 0, $e); |
|
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | } |
@@ -11,236 +11,236 @@ |
||
| 11 | 11 | |
| 12 | 12 | protected function setUp() |
| 13 | 13 | { |
| 14 | - if( !interface_exists( '\\Illuminate\\Contracts\\Filesystem\\Filesystem' ) ) { |
|
| 15 | - $this->markTestSkipped( 'Install Laravel framework first' ); |
|
| 14 | + if (!interface_exists('\\Illuminate\\Contracts\\Filesystem\\Filesystem')) { |
|
| 15 | + $this->markTestSkipped('Install Laravel framework first'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - $this->mock = $this->getMockBuilder( '\\Illuminate\\Contracts\\Filesystem\\Filesystem' ) |
|
| 18 | + $this->mock = $this->getMockBuilder('\\Illuminate\\Contracts\\Filesystem\\Filesystem') |
|
| 19 | 19 | ->disableOriginalConstructor() |
| 20 | 20 | ->getMock(); |
| 21 | 21 | |
| 22 | - $this->object = new \Aimeos\MW\Filesystem\Laravel( $this->mock ); |
|
| 22 | + $this->object = new \Aimeos\MW\Filesystem\Laravel($this->mock); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | protected function tearDown() |
| 27 | 27 | { |
| 28 | - unset( $this->object ); |
|
| 28 | + unset($this->object); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | public function testIsdir() |
| 33 | 33 | { |
| 34 | - $this->mock->expects( $this->once() )->method( 'directories' ) |
|
| 35 | - ->will( $this->returnValue( array( 't', 'test', 'es' ) ) ); |
|
| 34 | + $this->mock->expects($this->once())->method('directories') |
|
| 35 | + ->will($this->returnValue(array('t', 'test', 'es'))); |
|
| 36 | 36 | |
| 37 | - $this->assertTrue( $this->object->isdir( 'test' ) ); |
|
| 37 | + $this->assertTrue($this->object->isdir('test')); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | public function testIsdirFalse() |
| 42 | 42 | { |
| 43 | - $this->mock->expects( $this->once() )->method( 'directories' ) |
|
| 44 | - ->will( $this->returnValue( array( 't', 'es' ) ) ); |
|
| 43 | + $this->mock->expects($this->once())->method('directories') |
|
| 44 | + ->will($this->returnValue(array('t', 'es'))); |
|
| 45 | 45 | |
| 46 | - $this->assertFalse( $this->object->isdir( 'test' ) ); |
|
| 46 | + $this->assertFalse($this->object->isdir('test')); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testMkdir() |
| 51 | 51 | { |
| 52 | - $this->mock->expects( $this->once() )->method( 'makeDirectory' ); |
|
| 52 | + $this->mock->expects($this->once())->method('makeDirectory'); |
|
| 53 | 53 | |
| 54 | - $this->object->mkdir( 'test' ); |
|
| 54 | + $this->object->mkdir('test'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | public function testRmdir() |
| 59 | 59 | { |
| 60 | - $this->mock->expects( $this->once() )->method( 'deleteDirectory' ); |
|
| 60 | + $this->mock->expects($this->once())->method('deleteDirectory'); |
|
| 61 | 61 | |
| 62 | - $this->object->rmdir( 'test' ); |
|
| 62 | + $this->object->rmdir('test'); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | public function testScan() |
| 67 | 67 | { |
| 68 | - $list = array( 't', 'es', 'st' ); |
|
| 68 | + $list = array('t', 'es', 'st'); |
|
| 69 | 69 | |
| 70 | - $this->mock->expects( $this->once() )->method( 'directories' ) |
|
| 71 | - ->will( $this->returnValue( array( 't', 'es' ) ) ); |
|
| 70 | + $this->mock->expects($this->once())->method('directories') |
|
| 71 | + ->will($this->returnValue(array('t', 'es'))); |
|
| 72 | 72 | |
| 73 | - $this->mock->expects( $this->once() )->method( 'files' ) |
|
| 74 | - ->will( $this->returnValue( array( 'st' ) ) ); |
|
| 73 | + $this->mock->expects($this->once())->method('files') |
|
| 74 | + ->will($this->returnValue(array('st'))); |
|
| 75 | 75 | |
| 76 | 76 | $result = $this->object->scan(); |
| 77 | 77 | |
| 78 | - $this->assertInternalType( 'array', $result ); |
|
| 78 | + $this->assertInternalType('array', $result); |
|
| 79 | 79 | |
| 80 | - foreach( $result as $entry ) { |
|
| 81 | - $this->assertTrue( in_array( $entry, $list ) ); |
|
| 80 | + foreach ($result as $entry) { |
|
| 81 | + $this->assertTrue(in_array($entry, $list)); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | public function testSize() |
| 87 | 87 | { |
| 88 | - $this->mock->expects( $this->once() )->method( 'size' ) |
|
| 89 | - ->will( $this->returnValue( 4 ) ); |
|
| 88 | + $this->mock->expects($this->once())->method('size') |
|
| 89 | + ->will($this->returnValue(4)); |
|
| 90 | 90 | |
| 91 | - $result = $this->object->size( 'test' ); |
|
| 91 | + $result = $this->object->size('test'); |
|
| 92 | 92 | |
| 93 | - $this->assertEquals( 4, $result ); |
|
| 93 | + $this->assertEquals(4, $result); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | public function testTime() |
| 98 | 98 | { |
| 99 | - $this->mock->expects( $this->once() )->method( 'lastModified' ) |
|
| 100 | - ->will( $this->returnValue( 1 ) ); |
|
| 99 | + $this->mock->expects($this->once())->method('lastModified') |
|
| 100 | + ->will($this->returnValue(1)); |
|
| 101 | 101 | |
| 102 | - $result = $this->object->time( 'test' ); |
|
| 102 | + $result = $this->object->time('test'); |
|
| 103 | 103 | |
| 104 | - $this->assertGreaterThan( 0, $result ); |
|
| 104 | + $this->assertGreaterThan(0, $result); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | public function testRm() |
| 109 | 109 | { |
| 110 | - $this->mock->expects( $this->once() )->method( 'delete' ); |
|
| 110 | + $this->mock->expects($this->once())->method('delete'); |
|
| 111 | 111 | |
| 112 | - $this->object->rm( 'test' ); |
|
| 112 | + $this->object->rm('test'); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | public function testHas() |
| 117 | 117 | { |
| 118 | - $this->mock->expects( $this->once() )->method( 'exists' ) |
|
| 119 | - ->will( $this->returnValue( true ) ); |
|
| 118 | + $this->mock->expects($this->once())->method('exists') |
|
| 119 | + ->will($this->returnValue(true)); |
|
| 120 | 120 | |
| 121 | - $result = $this->object->has( 'test' ); |
|
| 121 | + $result = $this->object->has('test'); |
|
| 122 | 122 | |
| 123 | - $this->assertTrue( $result ); |
|
| 123 | + $this->assertTrue($result); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | public function testHasFalse() |
| 128 | 128 | { |
| 129 | - $this->mock->expects( $this->once() )->method( 'exists' ) |
|
| 130 | - ->will( $this->returnValue( false ) ); |
|
| 129 | + $this->mock->expects($this->once())->method('exists') |
|
| 130 | + ->will($this->returnValue(false)); |
|
| 131 | 131 | |
| 132 | - $result = $this->object->has( 'test' ); |
|
| 132 | + $result = $this->object->has('test'); |
|
| 133 | 133 | |
| 134 | - $this->assertFalse( $result ); |
|
| 134 | + $this->assertFalse($result); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
| 138 | 138 | public function testRead() |
| 139 | 139 | { |
| 140 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 141 | - ->will( $this->returnValue( 'test' ) ); |
|
| 140 | + $this->mock->expects($this->once())->method('get') |
|
| 141 | + ->will($this->returnValue('test')); |
|
| 142 | 142 | |
| 143 | - $result = $this->object->read( 'file' ); |
|
| 143 | + $result = $this->object->read('file'); |
|
| 144 | 144 | |
| 145 | - $this->assertEquals( 'test', $result ); |
|
| 145 | + $this->assertEquals('test', $result); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | public function testReadException() |
| 150 | 150 | { |
| 151 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 152 | - ->will( $this->throwException( new \Exception() ) ); |
|
| 151 | + $this->mock->expects($this->once())->method('get') |
|
| 152 | + ->will($this->throwException(new \Exception())); |
|
| 153 | 153 | |
| 154 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
| 155 | - $this->object->read( 'readinvalid' ); |
|
| 154 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
| 155 | + $this->object->read('readinvalid'); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | public function testReads() |
| 160 | 160 | { |
| 161 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 162 | - ->will( $this->returnValue( 'test' ) ); |
|
| 161 | + $this->mock->expects($this->once())->method('get') |
|
| 162 | + ->will($this->returnValue('test')); |
|
| 163 | 163 | |
| 164 | - $handle = $this->object->reads( 'file' ); |
|
| 164 | + $handle = $this->object->reads('file'); |
|
| 165 | 165 | |
| 166 | - $this->assertInternalType( 'resource', $handle ); |
|
| 167 | - $this->assertEquals( 'test', fgets( $handle ) ); |
|
| 166 | + $this->assertInternalType('resource', $handle); |
|
| 167 | + $this->assertEquals('test', fgets($handle)); |
|
| 168 | 168 | |
| 169 | - fclose( $handle ); |
|
| 169 | + fclose($handle); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
| 173 | 173 | public function testReadsException() |
| 174 | 174 | { |
| 175 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 176 | - ->will( $this->throwException( new \Exception() ) ); |
|
| 175 | + $this->mock->expects($this->once())->method('get') |
|
| 176 | + ->will($this->throwException(new \Exception())); |
|
| 177 | 177 | |
| 178 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
| 179 | - $this->object->reads( 'readinvalid' ); |
|
| 178 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
| 179 | + $this->object->reads('readinvalid'); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | public function testWrite() |
| 184 | 184 | { |
| 185 | - $this->mock->expects( $this->once() )->method( 'put' ); |
|
| 185 | + $this->mock->expects($this->once())->method('put'); |
|
| 186 | 186 | |
| 187 | - $this->object->write( 'file', 'test' ); |
|
| 187 | + $this->object->write('file', 'test'); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | |
| 191 | 191 | public function testWriteException() |
| 192 | 192 | { |
| 193 | - $this->mock->expects( $this->once() )->method( 'put' ) |
|
| 194 | - ->will( $this->throwException( new \Exception() ) ); |
|
| 193 | + $this->mock->expects($this->once())->method('put') |
|
| 194 | + ->will($this->throwException(new \Exception())); |
|
| 195 | 195 | |
| 196 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
| 197 | - $this->object->write( '', 'test' ); |
|
| 196 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
| 197 | + $this->object->write('', 'test'); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | |
| 201 | 201 | public function testWrites() |
| 202 | 202 | { |
| 203 | - $this->mock->expects( $this->once() )->method( 'put' ); |
|
| 203 | + $this->mock->expects($this->once())->method('put'); |
|
| 204 | 204 | |
| 205 | - $handle = fopen( __FILE__, 'r' ); |
|
| 205 | + $handle = fopen(__FILE__, 'r'); |
|
| 206 | 206 | |
| 207 | - $this->object->writes( 'file', $handle ); |
|
| 207 | + $this->object->writes('file', $handle); |
|
| 208 | 208 | |
| 209 | - fclose( $handle ); |
|
| 209 | + fclose($handle); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 | public function testWritesException() |
| 214 | 214 | { |
| 215 | - $this->mock->expects( $this->once() )->method( 'put' ) |
|
| 216 | - ->will( $this->throwException( new \Exception() ) ); |
|
| 215 | + $this->mock->expects($this->once())->method('put') |
|
| 216 | + ->will($this->throwException(new \Exception())); |
|
| 217 | 217 | |
| 218 | - $handle = fopen( __FILE__, 'r' ); |
|
| 218 | + $handle = fopen(__FILE__, 'r'); |
|
| 219 | 219 | |
| 220 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
| 221 | - $this->object->writes( 'file', $handle ); |
|
| 220 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
| 221 | + $this->object->writes('file', $handle); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | |
| 225 | 225 | public function testWritesException2() |
| 226 | 226 | { |
| 227 | - $this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' ); |
|
| 228 | - $this->object->writes( 'file', null ); |
|
| 227 | + $this->setExpectedException('\Aimeos\MW\Filesystem\Exception'); |
|
| 228 | + $this->object->writes('file', null); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | public function testMove() |
| 233 | 233 | { |
| 234 | - $this->mock->expects( $this->once() )->method( 'move' ); |
|
| 234 | + $this->mock->expects($this->once())->method('move'); |
|
| 235 | 235 | |
| 236 | - $this->object->move( 'file1', 'file2' ); |
|
| 236 | + $this->object->move('file1', 'file2'); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
| 240 | 240 | public function testCopy() |
| 241 | 241 | { |
| 242 | - $this->mock->expects( $this->once() )->method( 'copy' ); |
|
| 242 | + $this->mock->expects($this->once())->method('copy'); |
|
| 243 | 243 | |
| 244 | - $this->object->copy( 'file1', 'file2' ); |
|
| 244 | + $this->object->copy('file1', 'file2'); |
|
| 245 | 245 | } |
| 246 | 246 | } |