/**
  * @test
  */
 public function retrieveFailThrows()
 {
     $filesystem = $this->prophesize(Filesystem::class);
     $adapter = new FlysystemStorageAdapter($filesystem->reveal());
     $resource = Resource::create(['id' => 'xooxoo', 'uuid' => '123e4567-e89b-12d3-a456-426655440000']);
     $filesystem->get(Argument::type('string'))->shouldBeCalled()->willReturn(false);
     $this->setExpectedException(FileIOException::class);
     $adapter->retrieve($resource);
 }
Example #2
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());
 }