filesystem = new Filesystem(new Local(__DIR__)); } public function testPlugin() { $this->expectException(LogicException::class); $this->filesystem->addPlugin(new MyPlugin()); $this->assertEquals('result', $this->filesystem->beAwesome('result')); $this->filesystem->unknownPlugin(); } public function testInvalidPlugin() { $this->expectException(LogicException::class); $this->filesystem->addPlugin(new InvalidPlugin()); $this->filesystem->beInvalid(); } public function testMagicCall() { $this->filesystem->addPlugin(new AuthorizePlugin()); $badFile = $this->filesystem->get('bad', new File()); $this->assertFalse($badFile->authorize()); $goodFile = $this->filesystem->get('good', new File()); $this->assertTrue($goodFile->authorize()); } public function testBadMagicCall() { $this->expectException(BadMethodCallException::class); $file = $this->filesystem->get('foo', new File()); $file->nonExistentMethod(); } }