/** * This method must be called once the ResourceCollection has been processed. * * It will remove temporary files * * @todo this should be done in the __destruct method of ResourceCollection * * @param ResourceCollection $collection */ public function cleanup(ResourceCollection $collection) { if ($collection->isTemporary()) { try { $this->filesystem->remove($collection->getContext()); } catch (IOException $e) { // log this ? } } }
/** * @covers Alchemy\Zippy\Resource\ResourceCollection::canBeProcessedInPlace * @dataProvider provideVariousInPlaceResources */ public function testCanBeProcessedInPlace($expected, $first, $second, $third) { $collection = new ResourceCollection('supa-context', array($this->getInPlaceResource($first), $this->getInPlaceResource($second), $this->getInPlaceResource($third))); $this->assertInternalType('boolean', $collection->canBeProcessedInPlace()); $this->assertEquals($expected, $collection->canBeProcessedInPlace()); }