예제 #1
0
	public function testUserDeletesProfile()
	{
		$user = User::getUserByName('qwerty');
		$user->delete();
		
		$this->assertNull(UserProfile::get('qwerty'));
	}
	public function show($username)
	{
		$profile = UserProfile::get($username);
		if ($profile)
		{
			$this->profile = $profile;
			$this->render('profile/show');
		}
		else
		{
			$this->error(t('Profile not found'));
			$this->notfound();
		}
	}
	public function testUpdate()
	{
		$this->login('azerty');
		$this->request('user/profile/update', array(
			'firstName' => 'Keyboard',
			'lastName' => 'layout',
			'birthDate' => '1900-04-28',
			'biography' => 'My Bio'));

		$this->assertRedirected('user/profile/show/azerty');
		$this->assertFlashNotice('Profile updated');
		$profile = UserProfile::get('azerty');
		$this->assertEquals('Keyboard', $profile->firstName);
		$this->assertEquals('layout', $profile->lastName);
		$this->assertEquals('1900-04-28', date('Y-m-d', $profile->birthDate));
		$this->assertEquals('My Bio', $profile->biography);
	}