/** * @testdox Tests that a JUser object is injected into the application. * * @covers JApplicationBase::loadIdentity */ public function testLoadIdentityWithInjectedUser() { $mockUser = $this->getMock('JUser'); // Validate method chaining $this->assertSame($this->class, $this->class->loadIdentity($mockUser)); $this->assertAttributeSame($mockUser, 'identity', $this->class); }
/** * 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')); }