Example #1
0
 public function testFiltered()
 {
     $storage = new Storage();
     $storage->setSrcDisk($this->src_dir);
     $storage->setCropsDisk($this->crops_dir);
     $this->assertEquals(['02/another-200x300.jpg'], $storage->listAllCrops('^02/'));
 }
Example #2
0
 private function mockHelpersForDeleting()
 {
     // The path is to a sub dir
     $url = new URL(['path' => 'uploads/(?:thumbs/)?(.*)$']);
     $src = Mockery::mock('League\\Flysystem\\Filesystem')->shouldReceive('listContents')->withAnyArgs()->andReturn([['path' => 'me.jpg', 'basename' => 'me.jpg'], ['path' => 'unrelated.jpg', 'basename' => 'unrelated.jpg']])->shouldReceive('delete')->withAnyArgs()->once()->getMock();
     $crops = Mockery::mock('League\\Flysystem\\Filesystem')->shouldReceive('listContents')->withAnyArgs()->andReturn([['path' => 'me-200x100.jpg', 'basename' => 'me-200x100.jpg'], ['path' => 'me-200x200.jpg', 'basename' => 'me-200x200.jpg'], ['path' => 'me-200x300.jpg', 'basename' => 'me-200x300.jpg'], ['path' => 'unrelated.jpg', 'basename' => 'unrelated.jpg']])->shouldReceive('delete')->withAnyArgs()->times(3)->getMock();
     $storage = new Storage();
     $storage->setSrcDisk($src);
     $storage->setCropsDisk($crops);
     return new Helpers($url, $storage);
 }