public function testGetCommands() { CommandRegistry::register('test1', function () { }); CommandRegistry::register('test2', function () { }); $commands = CommandRegistry::getCommands(); $this->assertArrayHasKey('test1', $commands); $this->assertArrayHasKey('test2', $commands); $this->assertEquals(2, count($commands)); }
public function testProcessCustomCommand() { $commands = 'custom'; $callCheck = false; CommandRegistry::register('custom', function () use(&$callCheck) { $callCheck = true; }); $source = vfsStream::url('public') . '/img/test.jpg'; $target = vfsStream::url('public') . '/processed/img/test.$' . $commands . '.jpg'; $this->imageProcessing->process($source, $target, $commands); $this->assertTrue($callCheck); $folder = vfsStreamWrapper::getRoot()->getChild('processed')->getChild('img'); $this->assertTrue($folder->hasChild('test.$' . $commands . '.jpg')); $content = $folder->getChild('test.$' . $commands . '.jpg')->getContent(); $this->assertEquals(pack('H*', 'ffd8ff'), substr($content, 0, 3)); // ÿØÿ }