/** * Verifies support for processor instances. * * @covers ::isSupported */ public function testVerifyProcessorSupport() { // make sure that instances of ProcessorInterface are supported self::assertTrue($this->collection->isSupported(new CallbackProcessor(function () { }, function () { }))); }
/** * Creates a new delegating processor. */ protected function setUp() { $collection = new ProcessorCollection(); $collection->attach(new CallbackProcessor(function ($file) { return (bool) preg_match('/\\.php$/', $file); }, function ($file, $contents) { return str_replace('Hello', 'Goodbye', $contents); })); $collection->attach(new CallbackProcessor(function ($file) { return (bool) preg_match('/\\.php$/', $file); }, function ($file, $contents) { return str_replace('world', $file, $contents); })); $this->processor = new DelegatingProcessor(new ProcessorResolver($collection)); }
/** * Creates a new collection of processors and a resolver. */ protected function setUp() { $this->phpProcessorA = new CallbackProcessor(function ($file) { return (bool) preg_match('/\\.php$/', $file); }, function () { }); $this->phpProcessorB = new CallbackProcessor(function ($file) { return (bool) preg_match('/\\.php$/', $file); }, function () { }); $this->pngProcessor = new CallbackProcessor(function ($file) { return (bool) preg_match('/\\.png$/', $file); }, function () { }); $this->collection = new ProcessorCollection(); $this->collection->attach($this->phpProcessorA); $this->collection->attach($this->phpProcessorB); $this->collection->attach($this->pngProcessor); $this->resolver = new ProcessorResolver($this->collection); }