/** * Tests the JApplicationBase::loadIdentity method. * * @return void * * @since 12.1 * @covers JApplicationBase::loadIdentity */ public function testLoadIdentity() { $this->class->loadIdentity($this->getMock('JUser', array(), array(), '', false)); $this->assertAttributeInstanceOf('JUser', 'identity', $this->class, 'Tests that the identity object is the correct class.'); // Mock the session. JFactory::$session = $this->getMockSession(array('get.user.id' => 99)); $this->class->loadIdentity(); $this->assertEquals(99, TestReflection::getValue($this->class, 'identity')->get('id'), 'Tests that we got the identity from the factory.'); }
/** * Tests the JApplicationBase::loadIdentity and JApplicationBase::getIdentity methods. * * @return void * * @since 12.3 */ public function testLoadGetIdentity99() { // Mock the session. JFactory::$session = $this->getMockSession(array('get.user.id' => 99)); $this->class->loadIdentity(); $this->assertEquals(99, TestReflection::getValue($this->class, 'identity')->get('id'), 'Tests that we got the identity from the factory.'); }