@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | * @param \Illuminate\Filesystem\FilesystemManager $fsm Laravel file system manager object |
| 30 | 30 | * @param \Aimeos\MW\Config\Iface $config Configuration object |
| 31 | 31 | */ |
| 32 | - public function __construct( \Illuminate\Filesystem\FilesystemManager $fsm, \Aimeos\MW\Config\Iface $config ) |
|
| 32 | + public function __construct(\Illuminate\Filesystem\FilesystemManager $fsm, \Aimeos\MW\Config\Iface $config) |
|
| 33 | 33 | { |
| 34 | - parent::__construct( $config ); |
|
| 34 | + parent::__construct($config); |
|
| 35 | 35 | |
| 36 | 36 | $this->fsm = $fsm; |
| 37 | 37 | } |
@@ -44,19 +44,19 @@ discard block |
||
| 44 | 44 | * @return \Aimeos\MW\Filesystem\Iface File system object |
| 45 | 45 | * @throws \Aimeos\MW\Filesystem\Exception If an no configuration for that name is found |
| 46 | 46 | */ |
| 47 | - public function get( $name ) |
|
| 47 | + public function get($name) |
|
| 48 | 48 | { |
| 49 | - $key = $this->getConfig( $name ); |
|
| 49 | + $key = $this->getConfig($name); |
|
| 50 | 50 | |
| 51 | - if( is_string( $key ) ) |
|
| 51 | + if (is_string($key)) |
|
| 52 | 52 | { |
| 53 | - if( !isset( $this->objects[$key] ) ) { |
|
| 54 | - $this->objects[$key] = new \Aimeos\MW\Filesystem\Laravel( $this->fsm->disk( $key ) ); |
|
| 53 | + if (!isset($this->objects[$key])) { |
|
| 54 | + $this->objects[$key] = new \Aimeos\MW\Filesystem\Laravel($this->fsm->disk($key)); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return $this->objects[$key]; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - return parent::get( $name ); |
|
| 60 | + return parent::get($name); |
|
| 61 | 61 | } |
| 62 | 62 | } |
@@ -12,53 +12,53 @@ |
||
| 12 | 12 | |
| 13 | 13 | protected function setUp() |
| 14 | 14 | { |
| 15 | - if( !class_exists( '\Illuminate\Filesystem\FilesystemManager' ) ) { |
|
| 16 | - $this->markTestSkipped( 'Install the Laravel framework first' ); |
|
| 15 | + if (!class_exists('\Illuminate\Filesystem\FilesystemManager')) { |
|
| 16 | + $this->markTestSkipped('Install the Laravel framework first'); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - $this->storage = $this->getMockBuilder( '\Illuminate\Filesystem\FilesystemManager' ) |
|
| 20 | - ->setMethods( array( 'get' ) ) |
|
| 19 | + $this->storage = $this->getMockBuilder('\Illuminate\Filesystem\FilesystemManager') |
|
| 20 | + ->setMethods(array('get')) |
|
| 21 | 21 | ->disableOriginalConstructor() |
| 22 | 22 | ->getMock(); |
| 23 | 23 | |
| 24 | - $this->config = new \Aimeos\MW\Config\PHPArray( array(), array() ); |
|
| 25 | - $this->object = new \Aimeos\MW\Filesystem\Manager\Laravel( $this->storage, $this->config ); |
|
| 24 | + $this->config = new \Aimeos\MW\Config\PHPArray(array(), array()); |
|
| 25 | + $this->object = new \Aimeos\MW\Filesystem\Manager\Laravel($this->storage, $this->config); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | protected function tearDown() |
| 30 | 30 | { |
| 31 | - $this->config->set( 'resource/fs-media', null ); |
|
| 32 | - $this->config->set( 'resource/fs', null ); |
|
| 31 | + $this->config->set('resource/fs-media', null); |
|
| 32 | + $this->config->set('resource/fs', null); |
|
| 33 | 33 | |
| 34 | - unset( $this->object, $this->storage ); |
|
| 34 | + unset($this->object, $this->storage); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public function testGet() |
| 39 | 39 | { |
| 40 | - $fs = $this->getMockBuilder( 'Illuminate\Contracts\Filesystem\Filesystem' ) |
|
| 40 | + $fs = $this->getMockBuilder('Illuminate\Contracts\Filesystem\Filesystem') |
|
| 41 | 41 | ->disableOriginalConstructor() |
| 42 | 42 | ->getMock(); |
| 43 | 43 | |
| 44 | - $this->storage->expects( $this->once() )->method( 'get' ) |
|
| 45 | - ->will( $this->returnValue( $fs ) ); |
|
| 44 | + $this->storage->expects($this->once())->method('get') |
|
| 45 | + ->will($this->returnValue($fs)); |
|
| 46 | 46 | |
| 47 | - $this->config->set( 'resource/fs-media', 'local' ); |
|
| 48 | - $this->assertInstanceof( 'Aimeos\MW\Filesystem\Iface', $this->object->get( 'fs-media' ) ); |
|
| 47 | + $this->config->set('resource/fs-media', 'local'); |
|
| 48 | + $this->assertInstanceof('Aimeos\MW\Filesystem\Iface', $this->object->get('fs-media')); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testGetFallback() |
| 53 | 53 | { |
| 54 | - $this->config->set( 'resource/fs', array( 'adapter' => 'Standard', 'basedir' => __DIR__ ) ); |
|
| 55 | - $this->assertInstanceof( 'Aimeos\MW\Filesystem\Iface', $this->object->get( 'fs-media' ) ); |
|
| 54 | + $this->config->set('resource/fs', array('adapter' => 'Standard', 'basedir' => __DIR__)); |
|
| 55 | + $this->assertInstanceof('Aimeos\MW\Filesystem\Iface', $this->object->get('fs-media')); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | public function testGetException() |
| 60 | 60 | { |
| 61 | - $this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' ); |
|
| 62 | - $this->object->get( 'fs-media' ); |
|
| 61 | + $this->setExpectedException('Aimeos\MW\Filesystem\Exception'); |
|
| 62 | + $this->object->get('fs-media'); |
|
| 63 | 63 | } |
| 64 | 64 | } |