public function testRegisterLoadsMetadata() { $callable = array(new TestJob(), 'log'); $jobType = new JobType('service-id', 'type', $callable, Logger::ERROR); $classHierarchyMetadata = $this->getMockBuilder(ClassHierarchyMetadata::class)->disableOriginalConstructor()->getMock(); $classMetadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->getMock(); $this->metadataFactory->expects($this->once())->method('getMetadataForClass')->with(get_class($callable[0]))->willReturn($classHierarchyMetadata); $classHierarchyMetadata->expects($this->once())->method('getRootClassMetadata')->willReturn($classMetadata); $classMetadata->expects($this->once())->method('getParameterTypes')->willReturn(['ParameterTypes']); $classMetadata->expects($this->once())->method('getParameterOptions')->willReturn(['ParameterTypeOptions']); $classMetadata->expects($this->once())->method('getReturnType')->willReturn('ReturnType'); $classMetadata->expects($this->once())->method('getReturnOptions')->willReturn(['ReturnTypeOptions']); $this->subject->register($jobType, true); $this->assertSame($jobType, $this->subject->get($jobType->getName())); $this->assertEquals(['ParameterTypes'], $jobType->getParameterTypes()); $this->assertEquals(['ParameterTypeOptions'], $jobType->getParameterTypeOptions()); $this->assertEquals('ReturnType', $jobType->getReturnType()); $this->assertEquals(['ReturnTypeOptions'], $jobType->getReturnTypeOptions()); }