/** * @param string $regex * * @return Doctrine\Common\Collections\ArrayCollection * * @throws \Exception */ public function getOrders($regex = '/Orders.*.xml/') { try { $collection = $this->createCollection(); $files = $this->fileStore->getFiles($regex); $responseHandler = $this->responseHandlerFactory->create('order'); $responseHandler->bindCollection($files, $collection); return $collection; } catch (\Exception $e) { throw new IntegrationException($e->getMessage(), 0, $e); } }
public function testGetFiles() { $this->assertFileNotExists($this->path); $files = $this->store->getFiles('/.*/'); $this->assertEquals(0, count($files)); file_put_contents($this->path, 'this is a test'); $files = $this->store->getFiles('/test-.*/'); $this->assertEquals(1, count($files)); /** @var FileStoreFile $file */ $file = $files[0]; $this->assertEquals($this->name, $file->getName()); $this->assertEquals('this is a test', $file->getContents()); }