/** * Tests the JApplicationWeb::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')->willReturnSelf(); $mockDocument = $this->getMock('JDocument', array('test'), array(), '', false); $mockDocument->expects($this->any())->method('test')->willReturnSelf(); $mockLanguage = $this->getMock('JLanguage', array('test'), array(), '', false); $mockLanguage->expects($this->any())->method('test')->willReturnSelf(); $mockDispatcher = $this->getMock('\\Joomla\\Event\\DispatcherInterface', array('addListener', 'dispatch', 'removeListener'), array(), '', false); $mockDispatcher->expects($this->any())->method('dispatch')->willReturnSelf(); $this->class->initialise($mockSession, $mockDocument, $mockLanguage, $mockDispatcher); $this->assertSame($mockSession, $this->class->getSession()->test()); $this->assertSame($mockDocument, $this->class->getDocument()->test()); $this->assertSame($mockLanguage, $this->class->getLanguage()->test()); $this->assertSame($mockDispatcher, $this->class->getDispatcher()->dispatch('foo')); }