/** * Test if the added manager has been returned. * * @return void */ public function testGetManagers() { // define the methods to mock $methodsToMock = array('getLookup', 'getParamsAsArray', 'getBeanName', 'getMappedName', 'getBeanInterface', 'getFactory', 'getType', 'getName', 'toLookupNames'); // prepare the lookup names $lookupNames1 = array(AnnotationKeys::NAME => 'MockManager1', AnnotationKeys::BEAN_NAME => 'MockManager1', AnnotationKeys::BEAN_INTERFACE => 'MockInterface1', AnnotationKeys::MAPPED_NAME => 'MappedMockManager1'); // prepare the lookup names $lookupNames2 = array(AnnotationKeys::NAME => 'MockManager2', AnnotationKeys::BEAN_NAME => 'MockManager2', AnnotationKeys::BEAN_INTERFACE => 'MockInterface2', AnnotationKeys::MAPPED_NAME => 'MappedMockManager2'); // create a mock manager configuration $mockManagerConfiguration1 = $this->getMock('TechDivision\\Application\\Interfaces\\ManagerConfigurationInterface', $methodsToMock); $mockManagerConfiguration1->expects($this->any())->method('toLookupNames')->will($this->returnValue($lookupNames1)); // create a mock manager configuration $mockManagerConfiguration2 = $this->getMock('TechDivision\\Application\\Interfaces\\ManagerConfigurationInterface', $methodsToMock); $mockManagerConfiguration2->expects($this->any())->method('toLookupNames')->will($this->returnValue($lookupNames2)); // initialize the managers $mgr1 = new MockManager('test_01'); $mgr2 = new MockManager('test_02'); // add the managers $this->application->addManager($mgr1, $mockManagerConfiguration1); $this->application->addManager($mgr2, $mockManagerConfiguration2); $this->assertEquals(2, sizeof($this->application->getManagers())); foreach ($this->application->getManagers() as $manager) { $this->assertInstanceOf('TechDivision\\Application\\Interfaces\\ManagerInterface', $manager); } }