/** * Tests the JApplicationBase::loadIdentity and JApplicationBase::getIdentity methods. * * @return void * * @since 12.2 * @covers JApplicationBase::loadIdentity * @covers JApplicationBase::getIdentity */ public function testLoadGetIdentity() { $mock = $this->getMock('JUser', array(), array(), '', false); $this->class->loadIdentity($mock); $this->assertAttributeInstanceOf('JUser', 'identity', $this->class, 'Tests that the identity object is the correct class.'); $this->assertInstanceOf('JUser', $this->class->getIdentity()); // 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 * @covers JApplicationBase::loadIdentity * @covers JApplicationBase::getIdentity */ public function testLoadGetIdentityGetJUser() { $mock = $this->getMock('JUser', array(), array(), '', false); $this->class->loadIdentity($mock); $this->assertInstanceOf( 'JUser', $this->class->getIdentity() ); }