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'); }
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; }