Пример #1
0
 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());
 }
Пример #2
0
 /**
  * @param Collection $collection
  */
 public function updateProducts(Collection $collection)
 {
     try {
         $remoteFileName = $this->buildRemoteFileName("SingleFeed-%s.xml");
         $xmlHandler = $this->requestHandlerFactory->create('product');
         $xmlElement = $xmlHandler->buildElement($collection);
         $contents = $xmlElement->asXML();
         $this->fileStore->putFile($remoteFileName, $contents);
     } catch (\Exception $e) {
         throw new CollectionException($e->getMessage());
     }
 }