Ejemplo n.º 1
0
 /**
  * @test
  */
 public function testForEquality()
 {
     $adapter = new LocalAdapter(ROOT_TESTS . '/data/files');
     $pc = new ImprovedPathCalculator();
     $filesystem = new Filesystem($adapter);
     $filelib = new FileLibrary(new MemoryStorageAdapter(), new MemoryBackendAdapter(), null, ROOT_TESTS . '/data/temp');
     $storage1 = new FlysystemStorageAdapter($filesystem, $pc, false);
     $storage1->attachTo($filelib);
     $temp = $this->getSelfLussingManatee();
     $storage2 = new FilesystemStorageAdapter(ROOT_TESTS . '/data/files', $pc);
     $storage2->attachTo($filelib);
     $resource = Resource::create(['id' => 'lubber', 'uuid' => Uuid::uuid4()]);
     $ret = $storage1->store($resource, $temp);
     $this->assertFileEquals($storage1->retrieve($resource)->getPath(), $storage2->retrieve($resource)->getPath());
 }
 /**
  * @test
  */
 public function storeVersionFailThrows()
 {
     $filesystem = $this->prophesize(Filesystem::class);
     $adapter = new FlysystemStorageAdapter($filesystem->reveal());
     $resource = Resource::create(['id' => 'xooxoo', 'uuid' => '123e4567-e89b-12d3-a456-426655440000']);
     $tmp = $this->getTussi();
     $filesystem->put(Argument::type('string'), Argument::any(), ['visibility' => AdapterInterface::VISIBILITY_PRIVATE])->shouldBeCalled()->willReturn(false);
     $this->setExpectedException(FileIOException::class);
     $adapter->storeVersion($resource, Version::get('tussi'), $tmp);
 }