Example #1
0
 public function testIsValid()
 {
     $file = new File();
     $this->assertFalse($file->isValid(), 'File without any values cannot be valid');
     $file->setKey('key');
     $file->setFile($this->getTestFile());
     $this->assertTrue($file->isValid(), 'File with both key and file should be valid');
 }
Example #2
0
 public function find($key, $eagerLoad = false)
 {
     $file = new File();
     $file->setKey($key);
     $file->setMapper($this);
     $adapter = $this->getAdapter();
     $result = $adapter->findPaths($key);
     if (null === $result) {
         return null;
     }
     $file->setPaths($result);
     if (false !== $eagerLoad) {
         $info = $adapter->findInfo($key);
         $file->fromArray($info);
     }
     return $file;
 }