/** * Tests that the driver returns null when no Uploadable annotation * is found. */ public function testReadUploadableAnnotationReturnsNullWhenNonePresent() { $reader = $this->getMock('Doctrine\\Common\\Annotations\\Reader'); $reader->expects($this->once())->method('getClassAnnotation')->will($this->returnValue(null)); $entity = new DummyEntity(); $driver = new AnnotationDriver($reader); $annot = $driver->readUploadable(new \ReflectionClass($entity)); $this->assertEquals(null, $annot); }
/** * Checks to see if the class is uploadable. * * @param \ReflectionClass $class The class. * @throws \InvalidArgumentException */ protected function checkUploadable(\ReflectionClass $class) { if (null === $this->driver->readUploadable($class)) { throw new \InvalidArgumentException('The object is not uploadable.'); } }
/** * Tests if the object is Uploadable. * * @param object $obj The object. * @return boolean True if uploadable, false otherwise. */ protected function isUploadable($obj) { $class = $this->adapter->getReflectionClass($obj); return null !== $this->driver->readUploadable($class); }