public function testSetup() { $app = $this->getApp(); $adapter = new Local(PHPUNIT_ROOT . '/resources'); $fs = new Filesystem($adapter); $manager = new Manager([]); $manager->mountFilesystem('files', $fs); $manager->addPlugin(new Plugin\ThumbnailUrl($app)); $result = $fs->thumb('generic-logo.png', 200, 200, 'crop'); $this->assertEquals('/thumbs/200x200c/generic-logo.png', $result); }
public function testHandle() { $adapter = new Local(PHPUNIT_ROOT . '/resources'); $fs = new Filesystem($adapter); $manager = new Manager([]); $manager->mountFilesystem('files', $fs); $urlGenerator = $this->createMock(UrlGeneratorInterface::class); $urlGenerator->expects($this->once())->method('generate')->with('thumb', ['width' => 200, 'height' => 200, 'action' => 'c', 'file' => 'generic-logo.png'])->willReturn('/thumbs/200x200c/generic-logo.png'); $manager->addPlugin(new Plugin\ThumbnailUrl($urlGenerator)); $result = $fs->thumb('generic-logo.png', 200, 200, 'crop'); $this->assertEquals('/thumbs/200x200c/generic-logo.png', $result); }
public function testSetup() { $app = $this->getApp(); $adapter = new Local(PHPUNIT_ROOT . '/resources'); $fs1 = new Filesystem($adapter); $fs2 = new Filesystem($adapter); $fs3 = new Filesystem($adapter); $manager = new Manager([]); $manager->mountFilesystem('files', $fs1); $manager->mountFilesystem('cache', $fs2); $manager->mountFilesystem('something', $fs3); $manager->addPlugin(new Plugin\Authorized($app)); $this->assertTrue($fs1->authorized('')); $this->assertFalse($fs2->authorized('')); $this->assertFalse($fs3->authorized('')); }