示例#1
0
 /**
  * Tests the JWeb::initialise method with dependancy injection.
  *
  * @return  void
  *
  * @since   11.3
  */
 public function testInitialiseWithInjection()
 {
     $mockSession = $this->getMock('JSession', array('test'), array(), '', false);
     $mockSession->expects($this->any())->method('test')->will($this->returnValue('JSession'));
     $mockDocument = $this->getMock('JDocument', array('test'), array(), '', false);
     $mockDocument->expects($this->any())->method('test')->will($this->returnValue('JDocument'));
     $mockLanguage = $this->getMock('JLanguage', array('test'), array(), '', false);
     $mockLanguage->expects($this->any())->method('test')->will($this->returnValue('JLanguage'));
     $mockDispatcher = $this->getMock('JDispatcher', array('test'), array(), '', false);
     $mockDispatcher->expects($this->any())->method('test')->will($this->returnValue('JDispatcher'));
     $this->inspector->initialise($mockSession, $mockDocument, $mockLanguage, $mockDispatcher);
     $this->assertThat($this->inspector->getClassProperty('session')->test(), $this->equalTo('JSession'), 'Tests session injection.');
     $this->assertThat($this->inspector->getClassProperty('document')->test(), $this->equalTo('JDocument'), 'Tests document injection.');
     $this->assertThat($this->inspector->getClassProperty('language')->test(), $this->equalTo('JLanguage'), 'Tests language injection.');
     $this->assertThat($this->inspector->getClassProperty('dispatcher')->test(), $this->equalTo('JDispatcher'), 'Tests dispatcher injection.');
 }