mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.4
This commit is contained in:
commit
8135d405a3
8 changed files with 66 additions and 8 deletions
|
@ -369,6 +369,7 @@ class FileEngine extends CacheEngine {
|
|||
unlink($object->getPathName());
|
||||
}
|
||||
}
|
||||
$this->_File = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,8 @@ class CakeResponse {
|
|||
501 => 'Not Implemented',
|
||||
502 => 'Bad Gateway',
|
||||
503 => 'Service Unavailable',
|
||||
504 => 'Gateway Time-out'
|
||||
504 => 'Gateway Time-out',
|
||||
505 => 'Unsupported Version'
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1093,7 +1093,8 @@ class Router {
|
|||
* @return CakeRoute Matching route object.
|
||||
*/
|
||||
public static function currentRoute() {
|
||||
return self::$_currentRoute[count(self::$_currentRoute) - 1];
|
||||
$count = count(self::$_currentRoute) - 1;
|
||||
return ($count >= 0) ? self::$_currentRoute[$count] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -411,6 +411,32 @@ class FileEngineTest extends CakeTestCase {
|
|||
$this->assertTrue(Cache::write('test_groups3', 'value3', 'file_groups'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that clearing with repeat writes works properly
|
||||
*/
|
||||
public function testClearingWithRepeatWrites() {
|
||||
Cache::config('repeat', array(
|
||||
'engine' => 'File', 'groups' => array('users')
|
||||
));
|
||||
|
||||
$this->assertTrue(Cache::write('user', 'rchavik', 'repeat'));
|
||||
$this->assertEquals('rchavik', Cache::read('user', 'repeat'));
|
||||
|
||||
Cache::delete('user', 'repeat');
|
||||
$this->assertEquals(false, Cache::read('user', 'repeat'));
|
||||
|
||||
$this->assertTrue(Cache::write('user', 'ADmad', 'repeat'));
|
||||
$this->assertEquals('ADmad', Cache::read('user', 'repeat'));
|
||||
|
||||
Cache::clearGroup('users', 'repeat');
|
||||
$this->assertEquals(false, Cache::read('user', 'repeat'));
|
||||
|
||||
$this->assertTrue(Cache::write('user', 'markstory', 'repeat'));
|
||||
$this->assertEquals('markstory', Cache::read('user', 'repeat'));
|
||||
|
||||
Cache::drop('repeat');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that deleting from a groups-enabled config is possible
|
||||
*
|
||||
|
|
|
@ -361,7 +361,7 @@ class CakeResponseTest extends CakeTestCase {
|
|||
public function testHttpCodes() {
|
||||
$response = new CakeResponse();
|
||||
$result = $response->httpCodes();
|
||||
$this->assertEquals(39, count($result));
|
||||
$this->assertEquals(40, count($result));
|
||||
|
||||
$result = $response->httpCodes(100);
|
||||
$expected = array(100 => 'Continue');
|
||||
|
@ -374,7 +374,7 @@ class CakeResponseTest extends CakeTestCase {
|
|||
|
||||
$result = $response->httpCodes($codes);
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals(41, count($response->httpCodes()));
|
||||
$this->assertEquals(42, count($response->httpCodes()));
|
||||
|
||||
$result = $response->httpCodes(1337);
|
||||
$expected = array(1337 => 'Undefined Unicorn');
|
||||
|
@ -383,7 +383,7 @@ class CakeResponseTest extends CakeTestCase {
|
|||
$codes = array(404 => 'Sorry Bro');
|
||||
$result = $response->httpCodes($codes);
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals(41, count($response->httpCodes()));
|
||||
$this->assertEquals(42, count($response->httpCodes()));
|
||||
|
||||
$result = $response->httpCodes(404);
|
||||
$expected = array(404 => 'Sorry Bro');
|
||||
|
|
|
@ -2161,6 +2161,16 @@ class RouterTest extends CakeTestCase {
|
|||
$this->assertEquals(Router::stripPlugin($url, null), $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* testCurrentRouteWhenNonExistentRoute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCurrentRouteWhenNonExistentRoute() {
|
||||
$route = Router::currentRoute();
|
||||
$this->assertFalse($route);
|
||||
}
|
||||
|
||||
/**
|
||||
* testCurrentRoute
|
||||
*
|
||||
|
|
|
@ -8697,7 +8697,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->Form->inputDefaults(array('required' => false));
|
||||
$result = $this->Form->input('Contact.imrequired');
|
||||
$expected = array(
|
||||
'div' => array('class' => 'input text required'),
|
||||
'div' => array('class' => 'input text'),
|
||||
'label' => array('for' => 'ContactImrequired'),
|
||||
'Imrequired',
|
||||
'/label',
|
||||
|
@ -8711,6 +8711,23 @@ class FormHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Form->input('Contact.imrequired', array('required' => false));
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->input('Contact.imrequired', array('required' => true));
|
||||
$expected = array(
|
||||
'div' => array('class' => 'input text required'),
|
||||
'label' => array('for' => 'ContactImrequired'),
|
||||
'Imrequired',
|
||||
'/label',
|
||||
'input' => array(
|
||||
'required' => 'required', 'type' => 'text', 'name' => 'data[Contact][imrequired]',
|
||||
'id' => 'ContactImrequired'
|
||||
),
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->input('Contact.imrequired', array('required' => null));
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1271,8 +1271,10 @@ class FormHelper extends AppHelper {
|
|||
} elseif (is_array($div)) {
|
||||
$divOptions = array_merge($divOptions, $div);
|
||||
}
|
||||
|
||||
if ($this->_introspectModel($this->model(), 'validates', $this->field())) {
|
||||
if (
|
||||
$this->_extractOption('required', $options) !== false &&
|
||||
$this->_introspectModel($this->model(), 'validates', $this->field())
|
||||
) {
|
||||
$divOptions = $this->addClass($divOptions, 'required');
|
||||
}
|
||||
if (!isset($divOptions['tag'])) {
|
||||
|
|
Loading…
Reference in a new issue