/** * {@inheritDoc} */ public function loadMetadata($class) { if (is_object($class)) { $class = get_class($class); } if (!$this->supportsClass($class)) { throw new ClassNotSupportedException(sprintf('The class "%s" not supported for load event metadata.', $class)); } return $this->loader->loadMetadata($class); }
/** * Test load metadata and object not supported * * @expectedException \FivePercent\Component\Notifier\Exception\ClassNotSupportedException * @expectedExceptionMessage The class "MyEvent" not supported for load event metadata. */ public function testLoadMetadataAndObjectNotSupported() { $this->loader->expects($this->once())->method('supportsClass')->with('MyEvent')->will($this->returnValue(false)); $this->loader->expects($this->never())->method('loadMetadata'); $this->metadataFactory->loadMetadata('MyEvent'); }