Пример #1
0
 /**
  * Tests if the merge method fails with an exception if the class
  * name doesn't match when try to merge to descriptor instances.
  *
  * @return void
  * @expectedException AppserverIo\Routlt\Description\DescriptorException
  */
 public function testMergeWithNotMatchingDescriptor()
 {
     // initialize the annotation aliases
     $aliases = array(Resource::ANNOTATION => Resource::__getClass(), EnterpriseBean::ANNOTATION => EnterpriseBean::__getClass());
     // create a reflection class
     $reflectionClass = new ReflectionClass(__CLASS__, array(), $aliases);
     // initialize the descriptor instance from reflection class
     $this->descriptor->fromReflectionClass($reflectionClass);
     // initialize the descriptor to merge
     $descriptorToMerge = $this->getMockBuilder('AppserverIo\\Routlt\\Description\\PathDescriptor')->setMethods(array('getClassName'))->getMock();
     // mock the getClassName() method
     $descriptorToMerge->expects($this->exactly(2))->method('getClassName')->will($this->returnValue('UnknownClass'));
     // merge the descriptors
     $this->descriptor->merge($descriptorToMerge);
 }