/** * @runInSeparateProcess * @outputBuffering enabled * @dataProvider booleanProvider */ public function testLoginLogout($destroySession) { $identity = new CUserIdentity('testUser', 'testPassword'); $user = new CWebUser(); $user->init(); // be guest before login $this->assertTrue($user->isGuest); // do a login $this->assertTrue($user->login($identity)); // don't be guest after login $this->assertFalse($user->isGuest); $this->assertEquals('testUser', $user->getId()); $this->assertEquals('testUser', $user->getName()); $user->logout($destroySession); // be guest after logout $this->assertNull($user->getId()); $this->assertEquals($user->guestName, $user->getName()); }