Merge branch 'local/svn/1.2.x.x' into 1.2

This commit is contained in:
gwoo 2009-08-03 12:44:11 -07:00
commit 92fd7cf6f3
5 changed files with 43 additions and 5 deletions

View file

@ -810,7 +810,7 @@ if (!function_exists('file_put_contents')) {
foreach ($args[0] as $valueKey => $valueData) {
for ($i = 1; $i < $argc; $i++) {
if (isset($args[$i][$valueKey])) {
if (array_key_exists($valueKey, $args[$i])) {
continue 2;
}
}

View file

@ -323,7 +323,7 @@ class SecurityComponent extends Object {
if (strtolower($options['type']) == 'digest') {
$out[] = 'qop="auth"';
$out[] = 'nonce="' . uniqid() . '"';
$out[] = 'nonce="' . uniqid("") . '"';
$out[] = 'opaque="' . md5($options['realm']).'"';
}

View file

@ -54,6 +54,36 @@ class BasicsTest extends CakeTestCase {
Configure::write('localePaths', $this->_localePaths);
Configure::write('Config.language', $this->_language);
}
/**
* test the array_diff_key compatibility function.
*
* @return void
**/
function testArrayDiffKey() {
$one = array('one' => 1, 'two' => 2, 'three' => 3);
$two = array('one' => 'one', 'two' => 'two');
$result = array_diff_key($one, $two);
$expected = array('three' => 3);
$this->assertEqual($result, $expected);
$one = array('one' => array('value', 'value-two'), 'two' => 2, 'three' => 3);
$two = array('two' => 'two');
$result = array_diff_key($one, $two);
$expected = array('one' => array('value', 'value-two'), 'three' => 3);
$this->assertEqual($result, $expected);
$one = array('one' => null, 'two' => 2, 'three' => '', 'four' => 0);
$two = array('two' => 'two');
$result = array_diff_key($one, $two);
$expected = array('one' => null, 'three' => '', 'four' => 0);
$this->assertEqual($result, $expected);
$one = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
$two = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
$result = array_diff_key($one, $two);
$this->assertEqual($result, array());
}
/**
* testHttpBase method
*
@ -110,10 +140,10 @@ class BasicsTest extends CakeTestCase {
$_SERVER['HTTPS'] = 'off';
$this->assertFalse(env('HTTPS'));
$_SERVER['HTTPS'] = false;
$this->assertFalse(env('HTTPS'));
$_SERVER['HTTPS'] = '';
$this->assertFalse(env('HTTPS'));

View file

@ -363,6 +363,14 @@ class SecurityComponentTest extends CakeTestCase {
* @return void
*/
function testDigestAuth() {
$skip = $this->skipIf((version_compare(PHP_VERSION, '5.1') == -1) XOR (!function_exists('apache_request_headers')),
"%s Cannot run Digest Auth test for PHP versions < 5.1"
);
if ($skip) {
return;
}
$this->Controller->action = 'posted';
$_SERVER['PHP_AUTH_DIGEST'] = $digest = <<<DIGEST
Digest username="Mufasa",

View file

@ -291,7 +291,7 @@ class PaginatorHelperTest extends CakeTestCase {
$this->assertEqual($result, $expected);
unset($this->paginator->params['paging']['article']['options']);
unset($this->Paginator->params['paging']['Article']['options']);
$this->Paginator->params['paging']['Article']['options']['direction'] = 'desc';
$result = $this->Paginator->sortDir();
$expected = 'desc';