Skip to content

Commit

Permalink
Remove deprecated loggedIn
Browse files Browse the repository at this point in the history
remove deprecated String feature
  • Loading branch information
euromark committed Jan 7, 2014
1 parent 9efdb25 commit 7ee1084
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 34 deletions.
11 changes: 1 addition & 10 deletions Cake/Controller/Component/AuthComponent.php
Expand Up @@ -606,7 +606,7 @@ public function login($user = null) {
$this->Session->renew();
$this->Session->write(static::$sessionKey, $user);
}
return $this->loggedIn();
return (bool)$this->user();
}

/**
Expand Down Expand Up @@ -781,15 +781,6 @@ public function constructAuthenticate() {
return $this->_authenticateObjects;
}

/**
* Check whether or not the current user has data in the session, and is considered logged in.
*
* @return boolean true if the user is logged in, false otherwise
*/
public function loggedIn() {
return (bool)$this->user();
}

/**
* Set a flash message. Uses the Session component, and values from AuthComponent::$flash.
*
Expand Down
6 changes: 2 additions & 4 deletions Cake/Utility/String.php
Expand Up @@ -505,7 +505,7 @@ public static function tail($text, $length = 100, $options = array()) {
*
* ### Options:
*
* - `ellipsis` Will be used as Ending and appended to the trimmed string (`ending` is deprecated)
* - `ellipsis` Will be used as ending and appended to the trimmed string
* - `exact` If false, $text will not be cut mid-word
* - `html` If true, HTML tags would be handled correctly
*
Expand All @@ -519,9 +519,7 @@ public static function truncate($text, $length = 100, $options = array()) {
$default = array(
'ellipsis' => '...', 'exact' => true, 'html' => false
);
if (isset($options['ending'])) {
$default['ellipsis'] = $options['ending'];
} elseif (!empty($options['html']) && Configure::read('App.encoding') === 'UTF-8') {
if (!empty($options['html']) && Configure::read('App.encoding') === 'UTF-8') {
$default['ellipsis'] = "\xe2\x80\xa6";
}
$options = array_merge($default, $options);
Expand Down
1 change: 0 additions & 1 deletion Cake/Validation/Validation.php
Expand Up @@ -634,7 +634,6 @@ public static function phone($check, $regex = null, $country = 'all') {
switch ($country) {
case 'us':
case 'ca':
case 'can': // deprecated three-letter-code
case 'all':
// includes all NANPA members.
// see http://en.wikipedia.org/wiki/North_American_Numbering_Plan#List_of_NANPA_countries_and_territories
Expand Down
6 changes: 3 additions & 3 deletions Test/TestCase/Controller/Component/AuthComponentTest.php
Expand Up @@ -177,7 +177,7 @@ class_alias('AuthLoginFormAuthenticate', 'Cake\Controller\Component\Auth\AuthLog
$result = $this->Auth->login();
$this->assertTrue($result);

$this->assertTrue($this->Auth->loggedIn());
$this->assertTrue((bool)$this->Auth->user());
$this->assertEquals($user, $this->Auth->user());
}

Expand Down Expand Up @@ -1075,7 +1075,7 @@ class_alias('RequestLoginMockAuthenticate', 'Cake\Controller\Component\Auth\Requ
* @return void
*/
public function testLoginWithUserData() {
$this->assertFalse($this->Auth->loggedIn());
$this->assertFalse((bool)$this->Auth->user());

$user = array(
'username' => 'mariano',
Expand All @@ -1084,7 +1084,7 @@ public function testLoginWithUserData() {
'updated' => new \DateTime('2007-03-17 01:18:31')
);
$this->assertTrue($this->Auth->login($user));
$this->assertTrue($this->Auth->loggedIn());
$this->assertTrue((bool)$this->Auth->user());
$this->assertEquals($user['username'], $this->Auth->user('username'));
}

Expand Down
16 changes: 0 additions & 16 deletions Test/TestCase/Utility/StringTest.php
Expand Up @@ -504,22 +504,6 @@ public function testTruncate() {
podeís adquirirla.</span></p>
<p><span style="font-size: medium;"><a>... </a></span></p>';
$this->assertEquals($expected, $result);

// test deprecated `ending` (`ellipsis` taking precedence if both are defined)
$result = $this->Text->truncate($text1, 31, array(
'ending' => '.',
'exact' => false,
));
$expected = 'The quick brown fox jumps.';
$this->assertEquals($expected, $result);

$result = $this->Text->truncate($text1, 31, array(
'ellipsis' => '..',
'ending' => '.',
'exact' => false,
));
$expected = 'The quick brown fox jumps..';
$this->assertEquals($expected, $result);
}

/**
Expand Down

0 comments on commit 7ee1084

Please sign in to comment.