mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
correcting all the inverted assertEqual tests
$expected is the first argument. Now certain test results start to make sense: 1) MultibyteTest::testUsingMbStrtolower Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -ႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅ +ⴀⴁⴂⴃⴄⴅⴆⴇⴈⴉⴊⴋⴌⴍⴎⴏⴐⴑⴒⴓⴔⴕⴖⴗⴘⴙⴚⴛⴜⴝⴞⴟⴠⴡⴢⴣⴤⴥ
This commit is contained in:
parent
e24ef781e5
commit
0a53242e3e
59 changed files with 3691 additions and 3691 deletions
|
@ -59,19 +59,19 @@ class BasicsTest extends CakeTestCase {
|
|||
$two = array('one' => 'one', 'two' => 'two');
|
||||
$result = array_diff_key($one, $two);
|
||||
$expected = array('three' => 3);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$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);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$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);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$one = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
|
||||
$two = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
|
||||
|
@ -244,11 +244,11 @@ class BasicsTest extends CakeTestCase {
|
|||
public function testAm() {
|
||||
$result = am(array('one', 'two'), 2, 3, 4);
|
||||
$expected = array('one', 'two', 2, 3, 4);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = am(array('one' => array(2, 3), 'two' => array('foo')), array('one' => array(4, 5)));
|
||||
$expected = array('one' => array(4, 5),'two' => array('foo'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -360,35 +360,35 @@ class BasicsTest extends CakeTestCase {
|
|||
|
||||
$result = __('Plural Rule 1');
|
||||
$expected = 'Plural Rule 1 (translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __('Plural Rule 1 (from core)');
|
||||
$expected = 'Plural Rule 1 (from core translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __('Some string with %s', 'arguments');
|
||||
$expected = 'Some string with arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __('Some string with %s %s', 'multiple', 'arguments');
|
||||
$expected = 'Some string with multiple arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __('Some string with %s %s', array('multiple', 'arguments'));
|
||||
$expected = 'Some string with multiple arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __('Testing %2$s %1$s', 'order', 'different');
|
||||
$expected = 'Testing different order';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __('Testing %2$s %1$s', array('order', 'different'));
|
||||
$expected = 'Testing different order';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __('Testing %.2f number', 1.2345);
|
||||
$expected = 'Testing 1.23 number';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -401,27 +401,27 @@ class BasicsTest extends CakeTestCase {
|
|||
|
||||
$result = __n('%d = 1', '%d = 0 or > 1', 0);
|
||||
$expected = '%d = 0 or > 1 (translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __n('%d = 1', '%d = 0 or > 1', 1);
|
||||
$expected = '%d = 1 (translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', 2);
|
||||
$expected = '%d = 0 or > 1 (from core translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __n('%d item.', '%d items.', 1, 1);
|
||||
$expected = '1 item.';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __n('%d item for id %s', '%d items for id %s', 2, 2, '1234');
|
||||
$expected = '2 items for id 1234';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __n('%d item for id %s', '%d items for id %s', 2, array(2, '1234'));
|
||||
$expected = '2 items for id 1234';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -434,27 +434,27 @@ class BasicsTest extends CakeTestCase {
|
|||
|
||||
$result = __d('default', 'Plural Rule 1');
|
||||
$expected = 'Plural Rule 1 (translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __d('core', 'Plural Rule 1');
|
||||
$expected = 'Plural Rule 1';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __d('core', 'Plural Rule 1 (from core)');
|
||||
$expected = 'Plural Rule 1 (from core translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __d('core', 'Some string with %s', 'arguments');
|
||||
$expected = 'Some string with arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __d('core', 'Some string with %s %s', 'multiple', 'arguments');
|
||||
$expected = 'Some string with multiple arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __d('core', 'Some string with %s %s', array('multiple', 'arguments'));
|
||||
$expected = 'Some string with multiple arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -467,31 +467,31 @@ class BasicsTest extends CakeTestCase {
|
|||
|
||||
$result = __dn('default', '%d = 1', '%d = 0 or > 1', 0);
|
||||
$expected = '%d = 0 or > 1 (translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dn('core', '%d = 1', '%d = 0 or > 1', 0);
|
||||
$expected = '%d = 0 or > 1';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dn('core', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 0);
|
||||
$expected = '%d = 0 or > 1 (from core translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dn('default', '%d = 1', '%d = 0 or > 1', 1);
|
||||
$expected = '%d = 1 (translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dn('core', '%d item.', '%d items.', 1, 1);
|
||||
$expected = '1 item.';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dn('core', '%d item for id %s', '%d items for id %s', 2, 2, '1234');
|
||||
$expected = '2 items for id 1234';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dn('core', '%d item for id %s', '%d items for id %s', 2, array(2, '1234'));
|
||||
$expected = '2 items for id 1234';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -504,23 +504,23 @@ class BasicsTest extends CakeTestCase {
|
|||
|
||||
$result = __c('Plural Rule 1', 6);
|
||||
$expected = 'Plural Rule 1 (translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __c('Plural Rule 1 (from core)', 6);
|
||||
$expected = 'Plural Rule 1 (from core translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __c('Some string with %s', 6, 'arguments');
|
||||
$expected = 'Some string with arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __c('Some string with %s %s', 6, 'multiple', 'arguments');
|
||||
$expected = 'Some string with multiple arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __c('Some string with %s %s', 6, array('multiple', 'arguments'));
|
||||
$expected = 'Some string with multiple arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -533,31 +533,31 @@ class BasicsTest extends CakeTestCase {
|
|||
|
||||
$result = __dc('default', 'Plural Rule 1', 6);
|
||||
$expected = 'Plural Rule 1 (translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dc('default', 'Plural Rule 1 (from core)', 6);
|
||||
$expected = 'Plural Rule 1 (from core translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dc('core', 'Plural Rule 1', 6);
|
||||
$expected = 'Plural Rule 1';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dc('core', 'Plural Rule 1 (from core)', 6);
|
||||
$expected = 'Plural Rule 1 (from core translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dc('core', 'Some string with %s', 6, 'arguments');
|
||||
$expected = 'Some string with arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dc('core', 'Some string with %s %s', 6, 'multiple', 'arguments');
|
||||
$expected = 'Some string with multiple arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dc('core', 'Some string with %s %s', 6, array('multiple', 'arguments'));
|
||||
$expected = 'Some string with multiple arguments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -570,27 +570,27 @@ class BasicsTest extends CakeTestCase {
|
|||
|
||||
$result = __dcn('default', '%d = 1', '%d = 0 or > 1', 0, 6);
|
||||
$expected = '%d = 0 or > 1 (translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 6);
|
||||
$expected = '%d = 1 (from core translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dcn('core', '%d = 1', '%d = 0 or > 1', 0, 6);
|
||||
$expected = '%d = 0 or > 1';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dcn('core', '%d item.', '%d items.', 1, 6, 1);
|
||||
$expected = '1 item.';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dcn('core', '%d item for id %s', '%d items for id %s', 2, 6, 2, '1234');
|
||||
$expected = '2 items for id 1234';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __dcn('core', '%d item for id %s', '%d items for id %s', 2, 6, array(2, '1234'));
|
||||
$expected = '2 items for id 1234';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -662,11 +662,11 @@ class BasicsTest extends CakeTestCase {
|
|||
public function testConvertSlash() {
|
||||
$result = convertSlash('\path\to\location\\');
|
||||
$expected = '\path\to\location\\';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = convertSlash('/path/to/location/');
|
||||
$expected = 'path_to_location';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -710,13 +710,13 @@ class BasicsTest extends CakeTestCase {
|
|||
pr('this is a test');
|
||||
$result = ob_get_clean();
|
||||
$expected = "<pre>this is a test</pre>";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
ob_start();
|
||||
pr(array('this' => 'is', 'a' => 'test'));
|
||||
$result = ob_get_clean();
|
||||
$expected = "<pre>Array\n(\n [this] => is\n [a] => test\n)\n</pre>";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -117,13 +117,13 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
|
||||
$expected = array('BakeArticles', 'BakeArticlesBakeTags', 'BakeComments', 'BakeTags');
|
||||
$result = $this->Task->listAll('test');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Task->interactive = false;
|
||||
$result = $this->Task->listAll();
|
||||
|
||||
$expected = array('bake_articles', 'bake_articles_bake_tags', 'bake_comments', 'bake_tags');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -143,11 +143,11 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->getName('test');
|
||||
$expected = 'BakeComments';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Task->getName('test');
|
||||
$expected = 'BakeArticles';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,7 +187,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' Javascript, Ajax, CustomOne '));
|
||||
$result = $this->Task->doHelpers();
|
||||
$expected = array('Javascript', 'Ajax', 'CustomOne');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -200,7 +200,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' Javascript, Ajax, CustomOne, , '));
|
||||
$result = $this->Task->doHelpers();
|
||||
$expected = array('Javascript', 'Ajax', 'CustomOne');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -225,7 +225,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->doComponents();
|
||||
$expected = array('RequestHandler', 'Security');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -239,7 +239,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->doComponents();
|
||||
$expected = array('RequestHandler', 'Security');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -644,4 +644,4 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
);
|
||||
$this->Task->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
|
||||
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
|
||||
|
||||
$this->Task = $this->getMock('FixtureTask',
|
||||
$this->Task = $this->getMock('FixtureTask',
|
||||
array('in', 'err', 'createFile', '_stop', 'clear'),
|
||||
array($out, $out, $in)
|
||||
);
|
||||
|
@ -97,7 +97,7 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->importOptions('Article');
|
||||
$expected = array('schema' => 'Article', 'records' => true);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,9 +112,9 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->importOptions('Article');
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* test importOptions choosing from Table.
|
||||
*
|
||||
|
@ -126,7 +126,7 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
$this->Task->expects($this->at(2))->method('in')->will($this->returnValue('y'));
|
||||
$result = $this->Task->importOptions('Article');
|
||||
$expected = array('fromTable' => true);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,7 +178,7 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
|
||||
$this->Task->expects($this->at(0))->method('createFile')
|
||||
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class ArticleFixture/'));
|
||||
|
||||
|
||||
$this->Task->execute();
|
||||
}
|
||||
|
||||
|
|
|
@ -131,12 +131,12 @@ class ModelTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->listAll('test');
|
||||
$expected = array('bake_articles', 'bake_articles_bake_tags', 'bake_comments', 'bake_tags', 'category_threads');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Task->connection = 'test';
|
||||
$result = $this->Task->listAll();
|
||||
$expected = array('bake_articles', 'bake_articles_bake_tags', 'bake_comments', 'bake_tags', 'category_threads');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,7 +187,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
$this->Task->expects($this->at(0))->method('in')->will($this->returnValue('y'));
|
||||
$result = $this->Task->getTable('BakeArticle', 'test');
|
||||
$expected = 'bake_articles';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -199,7 +199,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
$this->Task->expects($this->any())->method('in')->will($this->onConsecutiveCalls('n', 'my_table'));
|
||||
$result = $this->Task->getTable('BakeArticle', 'test');
|
||||
$expected = 'my_table';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,7 +254,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
||||
$expected = array('notempty' => 'notempty', 'maxlength' => 'maxlength');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -275,7 +275,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
||||
$expected = array('notempty' => 'notempty');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -291,7 +291,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
||||
$expected = array('a_z_0_9' => '/^[a-z]{0,9}$/');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -352,7 +352,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
'time' => 'time'
|
||||
),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -370,10 +370,10 @@ class ModelTaskTest extends CakeTestCase {
|
|||
$this->Task->expects($this->once())->method('in')
|
||||
->with($anything, null, 'key')
|
||||
->will($this->returnValue('my_field'));
|
||||
|
||||
|
||||
$result = $this->Task->findPrimaryKey($fields);
|
||||
$expected = 'my_field';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -430,7 +430,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
),
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$model = new Model(array('ds' => 'test', 'name' => 'CategoryThread'));
|
||||
$result = $this->Task->findBelongsTo($model, array());
|
||||
|
@ -443,7 +443,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
),
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -472,7 +472,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
),
|
||||
),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$model = new Model(array('ds' => 'test', 'name' => 'CategoryThread'));
|
||||
$result = $this->Task->findHasOneAndMany($model, array());
|
||||
|
@ -492,7 +492,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
),
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -516,7 +516,7 @@ class ModelTaskTest extends CakeTestCase {
|
|||
),
|
||||
),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -750,7 +750,7 @@ STRINGEND;
|
|||
$path = APP . 'Plugin' . DS . 'ControllerTest' . DS . 'Model' . DS . 'BakeArticle.php';
|
||||
$this->Task->expects($this->once())->method('createFile')
|
||||
->with($path, new PHPUnit_Framework_Constraint_PCREMatch('/BakeArticle extends ControllerTestAppModel/'));
|
||||
|
||||
|
||||
$this->Task->bake('BakeArticle', array(), array());
|
||||
|
||||
$this->assertEqual(count(ClassRegistry::keys()), 0);
|
||||
|
@ -767,7 +767,7 @@ STRINGEND;
|
|||
$this->Task->path = '/my/path/';
|
||||
$this->Task->args = array('BakeArticle');
|
||||
$filename = '/my/path/BakeArticle.php';
|
||||
|
||||
|
||||
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(1));
|
||||
$this->Task->expects($this->once())->method('createFile')
|
||||
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle extends AppModel/'));
|
||||
|
@ -818,7 +818,7 @@ STRINGEND;
|
|||
$this->Task->path = '/my/path/';
|
||||
$this->Task->args = array('BakeArticle');
|
||||
$filename = '/my/path/BakeArticle.php';
|
||||
|
||||
|
||||
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(1));
|
||||
$this->Task->expects($this->at(0))->method('createFile')
|
||||
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch("/'BakeComment' \=\> array\(/"));
|
||||
|
@ -860,7 +860,7 @@ STRINGEND;
|
|||
$filename = '/my/path/BakeTag.php';
|
||||
$this->Task->expects($this->at(4))
|
||||
->method('createFile')->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeTag/'));
|
||||
|
||||
|
||||
$filename = '/my/path/CategoryThread.php';
|
||||
$this->Task->expects($this->at(5))->method('createFile')
|
||||
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class CategoryThread/'));
|
||||
|
|
|
@ -134,7 +134,7 @@ class TemplateTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->generate('classes', 'test_object', array('test' => 'foo'));
|
||||
$expected = "I got rendered\nfoo";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -401,7 +401,7 @@ class TestTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->getUserFixtures();
|
||||
$expected = array('app.pizza', 'app.topping', 'app.side_dish');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -497,15 +497,15 @@ class TestTaskTest extends CakeTestCase {
|
|||
public function testGenerateConstructor() {
|
||||
$result = $this->Task->generateConstructor('controller', 'PostsController');
|
||||
$expected = "new TestPostsController();\n\t\t\$this->Posts->constructClasses();\n";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Task->generateConstructor('model', 'Post');
|
||||
$expected = "ClassRegistry::init('Post');\n";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Task->generateConstructor('helper', 'FormHelper');
|
||||
$expected = "new FormHelper();\n";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -578,29 +578,29 @@ class TestTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->testCaseFileName('Model', 'Post');
|
||||
$expected = $this->Task->path . 'Case' . DS . 'Model' . DS . 'PostTest.php';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Task->testCaseFileName('Helper', 'Form');
|
||||
$expected = $this->Task->path . 'Case' . DS . 'View' . DS . 'Helper' . DS . 'FormHelperTest.php';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Task->testCaseFileName('Controller', 'Posts');
|
||||
$expected = $this->Task->path . 'Case' . DS . 'Controller' . DS . 'PostsControllerTest.php';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Task->testCaseFileName('Behavior', 'Containable');
|
||||
$expected = $this->Task->path . 'Case' . DS . 'Model' . DS . 'Behavior' . DS . 'ContainableBehaviorTest.php';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Task->testCaseFileName('Component', 'Auth');
|
||||
$expected = $this->Task->path . 'Case' . DS . 'Controller' . DS . 'Component' . DS . 'AuthComponentTest.php';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS ));
|
||||
$this->Task->plugin = 'TestTest';
|
||||
$result = $this->Task->testCaseFileName('Model', 'Post');
|
||||
$expected = APP . 'Plugin' . DS . 'TestTest' . DS . 'tests' . DS . 'Case' . DS . 'Model' . DS . 'PostTest.php';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -97,7 +97,7 @@ class ConsoleOutputTest extends CakeTestCase {
|
|||
function testStylesGet() {
|
||||
$result = $this->output->styles('error');
|
||||
$expected = array('text' => 'red', 'underline' => true);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->assertNull($this->output->styles('made_up_goop'));
|
||||
|
||||
|
@ -116,7 +116,7 @@ class ConsoleOutputTest extends CakeTestCase {
|
|||
$result = $this->output->styles('test');
|
||||
$expected = array('text' => 'red', 'background' => 'black');
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
|
||||
$this->assertTrue($this->output->styles('test', false), 'Removing a style should return true.');
|
||||
$this->assertNull($this->output->styles('test'), 'Removed styles should be null.');
|
||||
}
|
||||
|
@ -225,4 +225,4 @@ class ConsoleOutputTest extends CakeTestCase {
|
|||
|
||||
$this->output->write('<error>Bad</error> Regular', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -549,7 +549,7 @@ class DbAclTest extends CakeTestCase {
|
|||
array('AroTwoTest' => array('id' => '4', 'parent_id' => '1', 'model' => 'Group', 'foreign_key' => 3, 'alias' => 'users')),
|
||||
array('AroTwoTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'root'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Acl->Aco->node('ROOT/tpsReports/view/current');
|
||||
$expected = array(
|
||||
|
@ -558,7 +558,7 @@ class DbAclTest extends CakeTestCase {
|
|||
array('AcoTwoTest' => array('id' => '2', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'tpsReports')),
|
||||
array('AcoTwoTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT')),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -582,18 +582,18 @@ HTMLBLOC;
|
|||
|
||||
$result = $this->Controller->EmailTest->strip($content, true);
|
||||
$expected = "Previous content\n--alt-\n text/html; utf-8\n 7bit\n\n<p>My own html content</p>";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$content = '<p>Some HTML content with an <a href="mailto:test@example.com">email link</a>';
|
||||
$result = $this->Controller->EmailTest->strip($content, true);
|
||||
$expected = $content;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$content = '<p>Some HTML content with an ';
|
||||
$content .= '<a href="mailto:test@example.com,test2@example.com">email link</a>';
|
||||
$result = $this->Controller->EmailTest->strip($content, true);
|
||||
$expected = $content;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -147,10 +147,10 @@ class SessionComponentTest extends CakeTestCase {
|
|||
$expected = $Session->id();
|
||||
|
||||
$result = $Object->requestAction('/session_test/session_id');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Object->requestAction('/orange_session_test/session_id');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -569,7 +569,7 @@ class ControllerTest extends CakeTestCase {
|
|||
</html>';
|
||||
$result = str_replace(array("\t", "\r\n", "\n"), "", $result);
|
||||
$expected = str_replace(array("\t", "\r\n", "\n"), "", $expected);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
App::build(array(
|
||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
||||
|
@ -1035,7 +1035,7 @@ class ControllerTest extends CakeTestCase {
|
|||
$comment->set('someVar', 'data');
|
||||
$result = $TestController->validateErrors($comment);
|
||||
$expected = array('some_field' => array('error_message'), 'some_field2' => array('error_message2'));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
$this->assertEqual($TestController->validate($comment), 2);
|
||||
}
|
||||
|
||||
|
@ -1053,7 +1053,7 @@ class ControllerTest extends CakeTestCase {
|
|||
$result = $TestController->validateErrors($Post);
|
||||
|
||||
$expected = array('title' => array('This field cannot be left blank'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1078,7 +1078,7 @@ class ControllerTest extends CakeTestCase {
|
|||
'Model3.field3' => '23',
|
||||
);
|
||||
$result = $Controller->postConditions($data);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
|
||||
$data = array();
|
||||
|
@ -1093,7 +1093,7 @@ class ControllerTest extends CakeTestCase {
|
|||
'Model3.field3' => '23',
|
||||
);
|
||||
$result = $Controller->postConditions($data);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
|
||||
$data = array();
|
||||
|
@ -1119,7 +1119,7 @@ class ControllerTest extends CakeTestCase {
|
|||
'Model3.field3 <=' => '23',
|
||||
);
|
||||
$result = $Controller->postConditions($data, $ops);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -293,7 +293,7 @@ class AppImportTest extends CakeTestCase {
|
|||
|
||||
$result = App::objects('file', 'non_existing_configure');
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = App::objects('NonExistingType');
|
||||
$this->assertEqual($result, array());
|
||||
|
@ -335,11 +335,11 @@ class AppImportTest extends CakeTestCase {
|
|||
$result = App::objects('TestPlugin.helper');
|
||||
sort($result);
|
||||
$expected = array('OtherHelperHelper', 'PluggedHelperHelper', 'TestPluginAppHelper');
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
$result = App::objects('TestPlugin.View/Helper');
|
||||
sort($result);
|
||||
$expected = array('OtherHelperHelper', 'PluggedHelperHelper', 'TestPluginAppHelper');
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = App::objects('TestPlugin.component');
|
||||
$this->assertTrue(in_array('OtherComponent', $result));
|
||||
|
|
|
@ -447,7 +447,7 @@ class ObjectTest extends CakeTestCase {
|
|||
$this->object->testPersist('ObjectTestModel', true, $model, 'registry');
|
||||
|
||||
$result = ClassRegistry::keys();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$newModel = ClassRegistry::getObject('object_test_model');
|
||||
$this->assertEqual('ObjectTestModel', $newModel->name);
|
||||
|
@ -575,7 +575,7 @@ class ObjectTest extends CakeTestCase {
|
|||
));
|
||||
$result = $this->object->requestAction('/request_action_persistent/index');
|
||||
$expected = 'This is a test';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
@unlink(CACHE . 'persistent' . DS . 'persisterone.php');
|
||||
@unlink(CACHE . 'persistent' . DS . 'persisteroneregistry.php');
|
||||
|
@ -685,26 +685,26 @@ class ObjectTest extends CakeTestCase {
|
|||
|
||||
$result = $this->object->requestAction('/request_action/test_request_action');
|
||||
$expected = 'This is a test';
|
||||
$this->assertEqual($result, $expected);;
|
||||
$this->assertEqual($expected, $result);;
|
||||
|
||||
$result = $this->object->requestAction('/request_action/another_ra_test/2/5');
|
||||
$expected = 7;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction('/tests_apps/index', array('return'));
|
||||
$expected = 'This is the TestsAppsController index view';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction('/tests_apps/some_method');
|
||||
$expected = 5;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction('/request_action/paginate_request_action');
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = $this->object->requestAction('/request_action/normal_request_action');
|
||||
$expected = 'Hello World';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
App::build();
|
||||
}
|
||||
|
@ -723,27 +723,27 @@ class ObjectTest extends CakeTestCase {
|
|||
|
||||
$result = $this->object->requestAction('/test_plugin/tests/index', array('return'));
|
||||
$expected = 'test plugin index';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction('/test_plugin/tests/index/some_param', array('return'));
|
||||
$expected = 'test plugin index';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction(
|
||||
array('controller' => 'tests', 'action' => 'index', 'plugin' => 'test_plugin'), array('return')
|
||||
);
|
||||
$expected = 'test plugin index';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction('/test_plugin/tests/some_method');
|
||||
$expected = 25;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction(
|
||||
array('controller' => 'tests', 'action' => 'some_method', 'plugin' => 'test_plugin')
|
||||
);
|
||||
$expected = 25;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
App::build();
|
||||
CakePlugin::unload();
|
||||
|
@ -767,30 +767,30 @@ class ObjectTest extends CakeTestCase {
|
|||
array('controller' => 'request_action', 'action' => 'test_request_action')
|
||||
);
|
||||
$expected = 'This is a test';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction(
|
||||
array('controller' => 'request_action', 'action' => 'another_ra_test'),
|
||||
array('pass' => array('5', '7'))
|
||||
);
|
||||
$expected = 12;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction(
|
||||
array('controller' => 'tests_apps', 'action' => 'index'), array('return')
|
||||
);
|
||||
$expected = 'This is the TestsAppsController index view';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction(array('controller' => 'tests_apps', 'action' => 'some_method'));
|
||||
$expected = 5;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction(
|
||||
array('controller' => 'request_action', 'action' => 'normal_request_action')
|
||||
);
|
||||
$expected = 'Hello World';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction(
|
||||
array('controller' => 'request_action', 'action' => 'paginate_request_action')
|
||||
|
|
|
@ -2487,7 +2487,7 @@ class I18nTest extends CakeTestCase {
|
|||
$expected .= "broken up over multiple lines.\n";
|
||||
$expected .= "This is the third line.\n";
|
||||
$expected .= "This is the forth line. (translated)";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
// Windows Newline is \r\n
|
||||
$string = "This is a multiline translation\r\n";
|
||||
|
@ -2495,18 +2495,18 @@ class I18nTest extends CakeTestCase {
|
|||
$string .= "This is the third line.\r\n";
|
||||
$string .= "This is the forth line.";
|
||||
$result = __($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$singular = "valid\nsecond line";
|
||||
$plural = "valids\nsecond line";
|
||||
|
||||
$result = __n($singular, $plural, 1);
|
||||
$expected = "v\nsecond line";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __n($singular, $plural, 2);
|
||||
$expected = "vs\nsecond line";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = "This is a multiline translation\n";
|
||||
$string .= "broken up over multiple lines.\n";
|
||||
|
@ -2518,11 +2518,11 @@ class I18nTest extends CakeTestCase {
|
|||
|
||||
$result = __n($singular, $plural, 1);
|
||||
$expected = "%d is 1\n" . $string;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __n($singular, $plural, 2);
|
||||
$expected = "%d is 2-4\n" . $string;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
// Windows Newline is \r\n
|
||||
$string = "This is a multiline translation\r\n";
|
||||
|
@ -2535,11 +2535,11 @@ class I18nTest extends CakeTestCase {
|
|||
|
||||
$result = __n($singular, $plural, 1);
|
||||
$expected = "%d is 1\n" . str_replace("\r\n", "\n", $string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __n($singular, $plural, 2);
|
||||
$expected = "%d is 2-4\n" . str_replace("\r\n", "\n", $string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2576,15 +2576,15 @@ class I18nTest extends CakeTestCase {
|
|||
|
||||
$result = __n('%d = 1', '%d = 0 or > 1', (float)1);
|
||||
$expected = '%d is 1 (translated)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __n('%d = 1', '%d = 0 or > 1', (float)2);
|
||||
$expected = "%d ends in 2-4, not 12-14 (translated)";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __n('%d = 1', '%d = 0 or > 1', (float)5);
|
||||
$expected = "%d everything else (translated)";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2635,15 +2635,15 @@ class I18nTest extends CakeTestCase {
|
|||
Configure::write('Config.language', 'po');
|
||||
$result = __c('d_fmt', 5);
|
||||
$expected = '%m/%d/%Y';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __c('am_pm', 5);
|
||||
$expected = array('AM', 'PM');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __c('abmon', 5);
|
||||
$expected = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
function testTimeDefinitionJapanese(){
|
||||
|
@ -2652,15 +2652,15 @@ class I18nTest extends CakeTestCase {
|
|||
|
||||
$expected = "%Y年%m月%d日";
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __c('am_pm', 5);
|
||||
$expected = array("午前", "午後");
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = __c('abmon', 5);
|
||||
$expected = array(" 1月", " 2月", " 3月", " 4月", " 5月", " 6月", " 7月", " 8月", " 9月", "10月", "11月", "12月");
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -123,323 +123,323 @@ class L10nTest extends CakeTestCase {
|
|||
|
||||
$result = $l10n->map(array('afr', 'af'));
|
||||
$expected = array('afr' => 'af', 'af' => 'afr');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('alb', 'sq'));
|
||||
$expected = array('alb' => 'sq', 'sq' => 'alb');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('ara', 'ar'));
|
||||
$expected = array('ara' => 'ar', 'ar' => 'ara');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('hye', 'hy'));
|
||||
$expected = array('hye' => 'hy', 'hy' => 'hye');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('baq', 'eu'));
|
||||
$expected = array('baq' => 'eu', 'eu' => 'baq');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('baq', 'eu'));
|
||||
$expected = array('baq' => 'eu', 'eu' => 'baq');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('bos', 'bs'));
|
||||
$expected = array('bos' => 'bs', 'bs' => 'bos');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('bul', 'bg'));
|
||||
$expected = array('bul' => 'bg', 'bg' => 'bul');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('bel', 'be'));
|
||||
$expected = array('bel' => 'be', 'be' => 'bel');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('cat', 'ca'));
|
||||
$expected = array('cat' => 'ca', 'ca' => 'cat');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('chi', 'zh'));
|
||||
$expected = array('chi' => 'zh', 'zh' => 'chi');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('zho', 'zh'));
|
||||
$expected = array('zho' => 'zh', 'zh' => 'chi');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('hrv', 'hr'));
|
||||
$expected = array('hrv' => 'hr', 'hr' => 'hrv');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('ces', 'cs'));
|
||||
$expected = array('ces' => 'cs', 'cs' => 'cze');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('cze', 'cs'));
|
||||
$expected = array('cze' => 'cs', 'cs' => 'cze');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('dan', 'da'));
|
||||
$expected = array('dan' => 'da', 'da' => 'dan');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('dut', 'nl'));
|
||||
$expected = array('dut' => 'nl', 'nl' => 'dut');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('nld', 'nl'));
|
||||
$expected = array('nld' => 'nl', 'nl' => 'dut');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('nld'));
|
||||
$expected = array('nld' => 'nl');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('eng', 'en'));
|
||||
$expected = array('eng' => 'en', 'en' => 'eng');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('est', 'et'));
|
||||
$expected = array('est' => 'et', 'et' => 'est');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('fao', 'fo'));
|
||||
$expected = array('fao' => 'fo', 'fo' => 'fao');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('fas', 'fa'));
|
||||
$expected = array('fas' => 'fa', 'fa' => 'fas');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('per', 'fa'));
|
||||
$expected = array('per' => 'fa', 'fa' => 'fas');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('fin', 'fi'));
|
||||
$expected = array('fin' => 'fi', 'fi' => 'fin');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('fra', 'fr'));
|
||||
$expected = array('fra' => 'fr', 'fr' => 'fre');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('fre', 'fr'));
|
||||
$expected = array('fre' => 'fr', 'fr' => 'fre');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('gla', 'gd'));
|
||||
$expected = array('gla' => 'gd', 'gd' => 'gla');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('glg', 'gl'));
|
||||
$expected = array('glg' => 'gl', 'gl' => 'glg');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('deu', 'de'));
|
||||
$expected = array('deu' => 'de', 'de' => 'deu');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('ger', 'de'));
|
||||
$expected = array('ger' => 'de', 'de' => 'deu');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('ell', 'el'));
|
||||
$expected = array('ell' => 'el', 'el' => 'gre');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('gre', 'el'));
|
||||
$expected = array('gre' => 'el', 'el' => 'gre');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('heb', 'he'));
|
||||
$expected = array('heb' => 'he', 'he' => 'heb');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('hin', 'hi'));
|
||||
$expected = array('hin' => 'hi', 'hi' => 'hin');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('hun', 'hu'));
|
||||
$expected = array('hun' => 'hu', 'hu' => 'hun');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('ice', 'is'));
|
||||
$expected = array('ice' => 'is', 'is' => 'ice');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('isl', 'is'));
|
||||
$expected = array('isl' => 'is', 'is' => 'ice');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('ind', 'id'));
|
||||
$expected = array('ind' => 'id', 'id' => 'ind');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('gle', 'ga'));
|
||||
$expected = array('gle' => 'ga', 'ga' => 'gle');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('ita', 'it'));
|
||||
$expected = array('ita' => 'it', 'it' => 'ita');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('jpn', 'ja'));
|
||||
$expected = array('jpn' => 'ja', 'ja' => 'jpn');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('kor', 'ko'));
|
||||
$expected = array('kor' => 'ko', 'ko' => 'kor');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('lav', 'lv'));
|
||||
$expected = array('lav' => 'lv', 'lv' => 'lav');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('lit', 'lt'));
|
||||
$expected = array('lit' => 'lt', 'lt' => 'lit');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('mac', 'mk'));
|
||||
$expected = array('mac' => 'mk', 'mk' => 'mac');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('mkd', 'mk'));
|
||||
$expected = array('mkd' => 'mk', 'mk' => 'mac');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('may', 'ms'));
|
||||
$expected = array('may' => 'ms', 'ms' => 'may');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('msa', 'ms'));
|
||||
$expected = array('msa' => 'ms', 'ms' => 'may');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('mlt', 'mt'));
|
||||
$expected = array('mlt' => 'mt', 'mt' => 'mlt');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('nor', 'no'));
|
||||
$expected = array('nor' => 'no', 'no' => 'nor');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('nob', 'nb'));
|
||||
$expected = array('nob' => 'nb', 'nb' => 'nob');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('nno', 'nn'));
|
||||
$expected = array('nno' => 'nn', 'nn' => 'nno');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('pol', 'pl'));
|
||||
$expected = array('pol' => 'pl', 'pl' => 'pol');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('por', 'pt'));
|
||||
$expected = array('por' => 'pt', 'pt' => 'por');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('roh', 'rm'));
|
||||
$expected = array('roh' => 'rm', 'rm' => 'roh');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('ron', 'ro'));
|
||||
$expected = array('ron' => 'ro', 'ro' => 'rum');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('rum', 'ro'));
|
||||
$expected = array('rum' => 'ro', 'ro' => 'rum');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('rus', 'ru'));
|
||||
$expected = array('rus' => 'ru', 'ru' => 'rus');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('smi', 'sz'));
|
||||
$expected = array('smi' => 'sz', 'sz' => 'smi');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('scc', 'sr'));
|
||||
$expected = array('scc' => 'sr', 'sr' => 'scc');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('srp', 'sr'));
|
||||
$expected = array('srp' => 'sr', 'sr' => 'scc');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('slk', 'sk'));
|
||||
$expected = array('slk' => 'sk', 'sk' => 'slo');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('slo', 'sk'));
|
||||
$expected = array('slo' => 'sk', 'sk' => 'slo');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('slv', 'sl'));
|
||||
$expected = array('slv' => 'sl', 'sl' => 'slv');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('wen', 'sb'));
|
||||
$expected = array('wen' => 'sb', 'sb' => 'wen');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('spa', 'es'));
|
||||
$expected = array('spa' => 'es', 'es' => 'spa');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('swe', 'sv'));
|
||||
$expected = array('swe' => 'sv', 'sv' => 'swe');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('tha', 'th'));
|
||||
$expected = array('tha' => 'th', 'th' => 'tha');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('tso', 'ts'));
|
||||
$expected = array('tso' => 'ts', 'ts' => 'tso');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('tsn', 'tn'));
|
||||
$expected = array('tsn' => 'tn', 'tn' => 'tsn');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('tur', 'tr'));
|
||||
$expected = array('tur' => 'tr', 'tr' => 'tur');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('ukr', 'uk'));
|
||||
$expected = array('ukr' => 'uk', 'uk' => 'ukr');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('urd', 'ur'));
|
||||
$expected = array('urd' => 'ur', 'ur' => 'urd');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('ven', 've'));
|
||||
$expected = array('ven' => 've', 've' => 'ven');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('vie', 'vi'));
|
||||
$expected = array('vie' => 'vi', 'vi' => 'vie');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('xho', 'xh'));
|
||||
$expected = array('xho' => 'xh', 'xh' => 'xho');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('cy', 'cym'));
|
||||
$expected = array('cym' => 'cy', 'cy' => 'cym');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('yid', 'yi'));
|
||||
$expected = array('yid' => 'yi', 'yi' => 'yid');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->map(array('zul', 'zu'));
|
||||
$expected = array('zul' => 'zu', 'zu' => 'zul');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -455,7 +455,7 @@ class L10nTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'af' => array('language' => 'Afrikaans', 'locale' => 'afr', 'localeFallback' => 'afr', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('ar', 'ar-ae', 'ar-bh', 'ar-dz', 'ar-eg', 'ar-iq', 'ar-jo', 'ar-kw', 'ar-lb', 'ar-ly', 'ar-ma',
|
||||
'ar-om', 'ar-qa', 'ar-sa', 'ar-sy', 'ar-tn', 'ar-ye'));
|
||||
|
@ -478,43 +478,43 @@ class L10nTest extends CakeTestCase {
|
|||
'ar-tn' => array('language' => 'Arabic (Tunisia)', 'locale' => 'ar_tn', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'),
|
||||
'ar-ye' => array('language' => 'Arabic (Yemen)', 'locale' => 'ar_ye', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('be'));
|
||||
$expected = array(
|
||||
'be' => array('language' => 'Byelorussian', 'locale' => 'bel', 'localeFallback' => 'bel', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('bg'));
|
||||
$expected = array(
|
||||
'bg' => array('language' => 'Bulgarian', 'locale' => 'bul', 'localeFallback' => 'bul', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('bs'));
|
||||
$expected = array(
|
||||
'bs' => array('language' => 'Bosnian', 'locale' => 'bos', 'localeFallback' => 'bos', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('ca'));
|
||||
$expected = array(
|
||||
'ca' => array('language' => 'Catalan', 'locale' => 'cat', 'localeFallback' => 'cat', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('cs'));
|
||||
$expected = array(
|
||||
'cs' => array('language' => 'Czech', 'locale' => 'cze', 'localeFallback' => 'cze', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('da'));
|
||||
$expected = array(
|
||||
'da' => array('language' => 'Danish', 'locale' => 'dan', 'localeFallback' => 'dan', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('de', 'de-at', 'de-ch', 'de-de', 'de-li', 'de-lu'));
|
||||
$expected = array(
|
||||
|
@ -525,14 +525,14 @@ class L10nTest extends CakeTestCase {
|
|||
'de-li' => array('language' => 'German (Liechtenstein)', 'locale' => 'de_li', 'localeFallback' => 'deu', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'de-lu' => array('language' => 'German (Luxembourg)', 'locale' => 'de_lu', 'localeFallback' => 'deu', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('e', 'el'));
|
||||
$expected = array(
|
||||
'e' => array('language' => 'Greek', 'locale' => 'gre', 'localeFallback' => 'gre', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'el' => array('language' => 'Greek', 'locale' => 'gre', 'localeFallback' => 'gre', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('en', 'en-au', 'en-bz', 'en-ca', 'en-gb', 'en-ie', 'en-jm', 'en-nz', 'en-tt', 'en-us', 'en-za'));
|
||||
$expected = array(
|
||||
|
@ -548,7 +548,7 @@ class L10nTest extends CakeTestCase {
|
|||
'en-us' => array('language' => 'English (United States)', 'locale' => 'en_us', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'en-za' => array('language' => 'English (South Africa)', 'locale' => 'en_za', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('es', 'es-ar', 'es-bo', 'es-cl', 'es-co', 'es-cr', 'es-do', 'es-ec', 'es-es', 'es-gt', 'es-hn',
|
||||
'es-mx', 'es-ni', 'es-pa', 'es-pe', 'es-pr', 'es-py', 'es-sv', 'es-uy', 'es-ve'));
|
||||
|
@ -574,37 +574,37 @@ class L10nTest extends CakeTestCase {
|
|||
'es-uy' => array('language' => 'Spanish (Uruguay)', 'locale' => 'es_uy', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'es-ve' => array('language' => 'Spanish (Venezuela)', 'locale' => 'es_ve', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('et'));
|
||||
$expected = array(
|
||||
'et' => array('language' => 'Estonian', 'locale' => 'est', 'localeFallback' => 'est', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('eu'));
|
||||
$expected = array(
|
||||
'eu' => array('language' => 'Basque', 'locale' => 'baq', 'localeFallback' => 'baq', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('fa'));
|
||||
$expected = array(
|
||||
'fa' => array('language' => 'Farsi', 'locale' => 'per', 'localeFallback' => 'per', 'charset' => 'utf-8', 'direction' => 'rtl')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('fi'));
|
||||
$expected = array(
|
||||
'fi' => array('language' => 'Finnish', 'locale' => 'fin', 'localeFallback' => 'fin', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('fo'));
|
||||
$expected = array(
|
||||
'fo' => array('language' => 'Faeroese', 'locale' => 'fao', 'localeFallback' => 'fao', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('fr', 'fr-be', 'fr-ca', 'fr-ch', 'fr-fr', 'fr-lu'));
|
||||
$expected = array(
|
||||
|
@ -615,82 +615,82 @@ class L10nTest extends CakeTestCase {
|
|||
'fr-fr' => array('language' => 'French (France)', 'locale' => 'fr_fr', 'localeFallback' => 'fre', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'fr-lu' => array('language' => 'French (Luxembourg)', 'locale' => 'fr_lu', 'localeFallback' => 'fre', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('ga'));
|
||||
$expected = array(
|
||||
'ga' => array('language' => 'Irish', 'locale' => 'gle', 'localeFallback' => 'gle', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('gd', 'gd-ie'));
|
||||
$expected = array(
|
||||
'gd' => array('language' => 'Gaelic (Scots)', 'locale' => 'gla', 'localeFallback' => 'gla', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'gd-ie' => array('language' => 'Gaelic (Irish)', 'locale' => 'gd_ie', 'localeFallback' => 'gla', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('gl'));
|
||||
$expected = array(
|
||||
'gl' => array('language' => 'Galician', 'locale' => 'glg', 'localeFallback' => 'glg', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('he'));
|
||||
$expected = array(
|
||||
'he' => array('language' => 'Hebrew', 'locale' => 'heb', 'localeFallback' => 'heb', 'charset' => 'utf-8', 'direction' => 'rtl')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('hi'));
|
||||
$expected = array(
|
||||
'hi' => array('language' => 'Hindi', 'locale' => 'hin', 'localeFallback' => 'hin', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('hr'));
|
||||
$expected = array(
|
||||
'hr' => array('language' => 'Croatian', 'locale' => 'hrv', 'localeFallback' => 'hrv', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('hu'));
|
||||
$expected = array(
|
||||
'hu' => array('language' => 'Hungarian', 'locale' => 'hun', 'localeFallback' => 'hun', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('hy'));
|
||||
$expected = array(
|
||||
'hy' => array('language' => 'Armenian - Armenia', 'locale' => 'hye', 'localeFallback' => 'hye', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('id', 'in'));
|
||||
$expected = array(
|
||||
'id' => array('language' => 'Indonesian', 'locale' => 'ind', 'localeFallback' => 'ind', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'in' => array('language' => 'Indonesian', 'locale' => 'ind', 'localeFallback' => 'ind', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('is'));
|
||||
$expected = array(
|
||||
'is' => array('language' => 'Icelandic', 'locale' => 'ice', 'localeFallback' => 'ice', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('it', 'it-ch'));
|
||||
$expected = array(
|
||||
'it' => array('language' => 'Italian', 'locale' => 'ita', 'localeFallback' => 'ita', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'it-ch' => array('language' => 'Italian (Swiss) ', 'locale' => 'it_ch', 'localeFallback' => 'ita', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('ja'));
|
||||
$expected = array(
|
||||
'ja' => array('language' => 'Japanese', 'locale' => 'jpn', 'localeFallback' => 'jpn', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('ko', 'ko-kp', 'ko-kr'));
|
||||
$expected = array(
|
||||
|
@ -698,7 +698,7 @@ class L10nTest extends CakeTestCase {
|
|||
'ko-kp' => array('language' => 'Korea (North)', 'locale' => 'ko_kp', 'localeFallback' => 'kor', 'charset' => 'kr', 'direction' => 'ltr'),
|
||||
'ko-kr' => array('language' => 'Korea (South)', 'locale' => 'ko_kr', 'localeFallback' => 'kor', 'charset' => 'kr', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('koi8-r', 'ru', 'ru-mo'));
|
||||
$expected = array(
|
||||
|
@ -706,38 +706,38 @@ class L10nTest extends CakeTestCase {
|
|||
'ru' => array('language' => 'Russian', 'locale' => 'rus', 'localeFallback' => 'rus', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'ru-mo' => array('language' => 'Russian (Moldavia)', 'locale' => 'ru_mo', 'localeFallback' => 'rus', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('lt'));
|
||||
$expected = array(
|
||||
'lt' => array('language' => 'Lithuanian', 'locale' => 'lit', 'localeFallback' => 'lit', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('lv'));
|
||||
$expected = array(
|
||||
'lv' => array('language' => 'Latvian', 'locale' => 'lav', 'localeFallback' => 'lav', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('mk', 'mk-mk'));
|
||||
$expected = array(
|
||||
'mk' => array('language' => 'FYRO Macedonian', 'locale' => 'mk', 'localeFallback' => 'mac', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'mk-mk' => array('language' => 'Macedonian', 'locale' => 'mk_mk', 'localeFallback' => 'mac', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('ms'));
|
||||
$expected = array(
|
||||
'ms' => array('language' => 'Malaysian', 'locale' => 'may', 'localeFallback' => 'may', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('mt'));
|
||||
$expected = array(
|
||||
'mt' => array('language' => 'Maltese', 'locale' => 'mlt', 'localeFallback' => 'mlt', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('n', 'nl', 'nl-be'));
|
||||
$expected = array(
|
||||
|
@ -745,175 +745,175 @@ class L10nTest extends CakeTestCase {
|
|||
'nl' => array('language' => 'Dutch (Standard)', 'locale' => 'dut', 'localeFallback' => 'dut', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'nl-be' => array('language' => 'Dutch (Belgium)', 'locale' => 'nl_be', 'localeFallback' => 'dut', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog('nl');
|
||||
$expected = array('language' => 'Dutch (Standard)', 'locale' => 'dut', 'localeFallback' => 'dut', 'charset' => 'utf-8', 'direction' => 'ltr');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog('nld');
|
||||
$expected = array('language' => 'Dutch (Standard)', 'locale' => 'dut', 'localeFallback' => 'dut', 'charset' => 'utf-8', 'direction' => 'ltr');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog('dut');
|
||||
$expected = array('language' => 'Dutch (Standard)', 'locale' => 'dut', 'localeFallback' => 'dut', 'charset' => 'utf-8', 'direction' => 'ltr');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('nb'));
|
||||
$expected = array(
|
||||
'nb' => array('language' => 'Norwegian Bokmal', 'locale' => 'nob', 'localeFallback' => 'nor', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('nn', 'no'));
|
||||
$expected = array(
|
||||
'nn' => array('language' => 'Norwegian Nynorsk', 'locale' => 'nno', 'localeFallback' => 'nor', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'no' => array('language' => 'Norwegian', 'locale' => 'nor', 'localeFallback' => 'nor', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('p', 'pl'));
|
||||
$expected = array(
|
||||
'p' => array('language' => 'Polish', 'locale' => 'pol', 'localeFallback' => 'pol', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'pl' => array('language' => 'Polish', 'locale' => 'pol', 'localeFallback' => 'pol', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('pt', 'pt-br'));
|
||||
$expected = array(
|
||||
'pt' => array('language' => 'Portuguese (Portugal)', 'locale' => 'por', 'localeFallback' => 'por', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'pt-br' => array('language' => 'Portuguese (Brazil)', 'locale' => 'pt_br', 'localeFallback' => 'por', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('rm'));
|
||||
$expected = array(
|
||||
'rm' => array('language' => 'Rhaeto-Romanic', 'locale' => 'roh', 'localeFallback' => 'roh', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('ro', 'ro-mo'));
|
||||
$expected = array(
|
||||
'ro' => array('language' => 'Romanian', 'locale' => 'rum', 'localeFallback' => 'rum', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'ro-mo' => array('language' => 'Romanian (Moldavia)', 'locale' => 'ro_mo', 'localeFallback' => 'rum', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('sb'));
|
||||
$expected = array(
|
||||
'sb' => array('language' => 'Sorbian', 'locale' => 'wen', 'localeFallback' => 'wen', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('sk'));
|
||||
$expected = array(
|
||||
'sk' => array('language' => 'Slovak', 'locale' => 'slo', 'localeFallback' => 'slo', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('sl'));
|
||||
$expected = array(
|
||||
'sl' => array('language' => 'Slovenian', 'locale' => 'slv', 'localeFallback' => 'slv', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('sq'));
|
||||
$expected = array(
|
||||
'sq' => array('language' => 'Albanian', 'locale' => 'alb', 'localeFallback' => 'alb', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('sr'));
|
||||
$expected = array(
|
||||
'sr' => array('language' => 'Serbian', 'locale' => 'scc', 'localeFallback' => 'scc', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('sv', 'sv-fi'));
|
||||
$expected = array(
|
||||
'sv' => array('language' => 'Swedish', 'locale' => 'swe', 'localeFallback' => 'swe', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'sv-fi' => array('language' => 'Swedish (Finland)', 'locale' => 'sv_fi', 'localeFallback' => 'swe', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('sx'));
|
||||
$expected = array(
|
||||
'sx' => array('language' => 'Sutu', 'locale' => 'sx', 'localeFallback' => 'sx', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('sz'));
|
||||
$expected = array(
|
||||
'sz' => array('language' => 'Sami (Lappish)', 'locale' => 'smi', 'localeFallback' => 'smi', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('th'));
|
||||
$expected = array(
|
||||
'th' => array('language' => 'Thai', 'locale' => 'tha', 'localeFallback' => 'tha', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('tn'));
|
||||
$expected = array(
|
||||
'tn' => array('language' => 'Tswana', 'locale' => 'tsn', 'localeFallback' => 'tsn', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('tr'));
|
||||
$expected = array(
|
||||
'tr' => array('language' => 'Turkish', 'locale' => 'tur', 'localeFallback' => 'tur', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('ts'));
|
||||
$expected = array(
|
||||
'ts' => array('language' => 'Tsonga', 'locale' => 'tso', 'localeFallback' => 'tso', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('uk'));
|
||||
$expected = array(
|
||||
'uk' => array('language' => 'Ukrainian', 'locale' => 'ukr', 'localeFallback' => 'ukr', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('ur'));
|
||||
$expected = array(
|
||||
'ur' => array('language' => 'Urdu', 'locale' => 'urd', 'localeFallback' => 'urd', 'charset' => 'utf-8', 'direction' => 'rtl')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('ve'));
|
||||
$expected = array(
|
||||
've' => array('language' => 'Venda', 'locale' => 'ven', 'localeFallback' => 'ven', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('vi'));
|
||||
$expected = array(
|
||||
'vi' => array('language' => 'Vietnamese', 'locale' => 'vie', 'localeFallback' => 'vie', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('cy'));
|
||||
$expected = array(
|
||||
'cy' => array('language' => 'Welsh', 'locale' => 'cym', 'localeFallback' => 'cym', 'charset' => 'utf-8',
|
||||
'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('xh'));
|
||||
$expected = array(
|
||||
'xh' => array('language' => 'Xhosa', 'locale' => 'xho', 'localeFallback' => 'xho', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('yi'));
|
||||
$expected = array(
|
||||
'yi' => array('language' => 'Yiddish', 'locale' => 'yid', 'localeFallback' => 'yid', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('zh', 'zh-cn', 'zh-hk', 'zh-sg', 'zh-tw'));
|
||||
$expected = array(
|
||||
|
@ -923,13 +923,13 @@ class L10nTest extends CakeTestCase {
|
|||
'zh-sg' => array('language' => 'Chinese (Singapore)', 'locale' => 'zh_sg', 'localeFallback' => 'chi', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'zh-tw' => array('language' => 'Chinese (Taiwan)', 'locale' => 'zh_tw', 'localeFallback' => 'chi', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('zu'));
|
||||
$expected = array(
|
||||
'zu' => array('language' => 'Zulu', 'locale' => 'zul', 'localeFallback' => 'zul', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('en-nz', 'es-do', 'sz', 'ar-lb', 'zh-hk', 'pt-br'));
|
||||
$expected = array(
|
||||
|
@ -940,8 +940,8 @@ class L10nTest extends CakeTestCase {
|
|||
'zh-hk' => array('language' => 'Chinese (Hong Kong)', 'locale' => 'zh_hk', 'localeFallback' => 'chi', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'pt-br' => array('language' => 'Portuguese (Brazil)', 'locale' => 'pt_br', 'localeFallback' => 'por', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $l10n->catalog(array('eng', 'deu', 'zho', 'rum', 'zul', 'yid'));
|
||||
$expected = array(
|
||||
'eng' => array('language' => 'English', 'locale' => 'eng', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
|
@ -951,6 +951,6 @@ class L10nTest extends CakeTestCase {
|
|||
'zul' => array('language' => 'Zulu', 'locale' => 'zul', 'localeFallback' => 'zul', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'yid' => array('language' => 'Yiddish', 'locale' => 'yid', 'localeFallback' => 'yid', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -35,7 +35,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
* @access public
|
||||
*/
|
||||
public $fixtures = array(
|
||||
'core.article', 'core.article_featured', 'core.article_featureds_tags',
|
||||
'core.article', 'core.article_featured', 'core.article_featureds_tags',
|
||||
'core.articles_tag', 'core.attachment', 'core.category',
|
||||
'core.comment', 'core.featured', 'core.tag', 'core.user'
|
||||
);
|
||||
|
@ -131,7 +131,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
|
||||
$result = Set::extract('/Comment/keep', $r);
|
||||
$this->assertEqual(array_shift($result), array('keep' => array('User' => array())));
|
||||
|
||||
|
||||
$result = Set::extract('/Article/keep', $r);
|
||||
$this->assertEqual(array_shift($result), array('keep' => array('Comment' => array())));
|
||||
|
||||
|
@ -273,7 +273,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'published' => 'Y', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31'
|
||||
))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -317,7 +317,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Article->contain('User', 'Comment');
|
||||
$result = $this->Article->find('all', array('recursive' => 1));
|
||||
|
@ -382,7 +382,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Comment' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -425,7 +425,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('all', array('contain' => array('User', 'Comment')));
|
||||
$expected = array(
|
||||
|
@ -489,7 +489,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Comment' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -574,7 +574,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Comment' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Article->contain(array('User' => 'ArticleFeatured'));
|
||||
$result = $this->Article->find('all', array('recursive' => 2));
|
||||
|
@ -636,7 +636,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Article->contain(array('User' => array('ArticleFeatured', 'Comment')));
|
||||
$result = $this->Article->find('all', array('recursive' => 2));
|
||||
|
@ -727,7 +727,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Article->contain(array('User' => array('ArticleFeatured')), 'Tag', array('Comment' => 'Attachment'));
|
||||
$result = $this->Article->find('all', array('recursive' => 2));
|
||||
|
@ -836,7 +836,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Tag' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -920,7 +920,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Comment' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('all', array('contain' => array('User' => 'ArticleFeatured')));
|
||||
$expected = array(
|
||||
|
@ -981,7 +981,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('all', array('contain' => array('User' => array('ArticleFeatured', 'Comment'))));
|
||||
$expected = array(
|
||||
|
@ -1071,7 +1071,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('all', array('contain' => array('User' => 'ArticleFeatured', 'Tag', 'Comment' => 'Attachment')));
|
||||
$expected = array(
|
||||
|
@ -1179,7 +1179,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Tag' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1252,7 +1252,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->User->contain(array('ArticleFeatured' => array('Featured' => 'Category', 'Comment' => array('Article', 'Attachment'))));
|
||||
$result = $this->User->find('all', array('recursive' => 3));
|
||||
|
@ -1379,7 +1379,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->User->contain(array('ArticleFeatured' => array('Featured' => 'Category', 'Comment' => 'Attachment'), 'Article'));
|
||||
$result = $this->User->find('all', array('recursive' => 3));
|
||||
|
@ -1500,7 +1500,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1572,7 +1572,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->User->find('all', array('contain' => array('ArticleFeatured' => array('Featured' => 'Category', 'Comment' => array('Article', 'Attachment')))));
|
||||
$expected = array(
|
||||
|
@ -1698,7 +1698,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->User->find('all', array('contain' => array('ArticleFeatured' => array('Featured' => 'Category', 'Comment' => 'Attachment'), 'Article')));
|
||||
$expected = array(
|
||||
|
@ -1818,7 +1818,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1888,7 +1888,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$r = $this->User->find('all', array('contain' => array(
|
||||
'ArticleFeatured' => array(
|
||||
|
@ -1994,7 +1994,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$orders = array(
|
||||
'title DESC', 'title DESC, published DESC',
|
||||
|
@ -2064,7 +2064,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2138,7 +2138,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->User->resetBindings();
|
||||
|
||||
|
@ -2267,7 +2267,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->User->resetBindings();
|
||||
|
||||
|
@ -2390,7 +2390,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2462,7 +2462,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->__assertBindings($this->User, array('hasMany' => array('ArticleFeatured')));
|
||||
$this->__assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured')));
|
||||
|
@ -2599,7 +2599,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->__assertBindings($this->User, array('hasMany' => array('ArticleFeatured')));
|
||||
$this->__assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured'), 'hasMany' => array('Comment')));
|
||||
|
@ -2736,7 +2736,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->__assertBindings($this->User, array('hasMany' => array('ArticleFeatured')));
|
||||
$this->__assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured'), 'hasMany' => array('Comment')));
|
||||
|
@ -2867,7 +2867,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'ArticleFeatured' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->__assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured')));
|
||||
$this->__assertBindings($this->User->Article);
|
||||
|
@ -2899,7 +2899,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
array('Article' => array('title' => 'Second Article'), 'User' => array('user' => 'larry', 'id' => 3)),
|
||||
array('Article' => array('title' => 'Third Article'), 'User' => array('user' => 'mariano', 'id' => 1)),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('all', array(
|
||||
'contain' => array('User(id, user)'),
|
||||
|
@ -2910,7 +2910,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
array('Article' => array('title' => 'Second Article'), 'User' => array('user' => 'larry', 'id' => 3)),
|
||||
array('Article' => array('title' => 'Third Article'), 'User' => array('user' => 'mariano', 'id' => 1)),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('all', array(
|
||||
'contain' => array(
|
||||
|
@ -2952,7 +2952,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Comment' => array()
|
||||
),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3019,7 +3019,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Tag' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Article->contain(array('User(id,user)', 'Tag' => array('fields' => array('tag', 'created'))));
|
||||
$result = $this->Article->find('all', array('fields' => array('title')));
|
||||
|
@ -3046,7 +3046,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Tag' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('all', array(
|
||||
'fields' => array('title'),
|
||||
|
@ -3075,7 +3075,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Tag' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Article->contain(array(
|
||||
'User(id,user)',
|
||||
|
@ -3102,7 +3102,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'Tag' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->assertTrue(empty($this->User->Article->hasAndBelongsToMany['Tag']['conditions']));
|
||||
|
||||
|
@ -3136,15 +3136,15 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
function testOtherFinds() {
|
||||
$result = $this->Article->find('count');
|
||||
$expected = 3;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('count', array('conditions' => array('Article.id >' => '1')));
|
||||
$expected = 2;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('count', array('contain' => array()));
|
||||
$expected = 3;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Article->contain(array('User(id,user)', 'Tag' => array('fields' => array('tag', 'created'), 'conditions' => array('created >=' => '2007-03-18 12:24'))));
|
||||
$result = $this->Article->find('first', array('fields' => array('title')));
|
||||
|
@ -3153,7 +3153,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'User' => array('id' => 1, 'user' => 'mariano'),
|
||||
'Tag' => array(array('tag' => 'tag2', 'created' => '2007-03-18 12:24:23'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Article->contain(array('User(id,user)', 'Tag' => array('fields' => array('tag', 'created'))));
|
||||
$result = $this->Article->find('first', array('fields' => array('title')));
|
||||
|
@ -3165,7 +3165,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
array('tag' => 'tag2', 'created' => '2007-03-18 12:24:23')
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('first', array(
|
||||
'fields' => array('title'),
|
||||
|
@ -3177,7 +3177,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'User' => array('id' => 1, 'user' => 'mariano'),
|
||||
'Tag' => array()
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('list', array(
|
||||
'contain' => array('User(id,user)'),
|
||||
|
@ -3188,7 +3188,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
2 => 'Second Article',
|
||||
3 => 'Third Article'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3248,7 +3248,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
array('comment' => 'Fourth Comment for First Article', 'article_id' => 1)
|
||||
)
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('all', array('fields' => array('title', 'User.id', 'User.user'), 'limit' => 1, 'page' => 2, 'order' => 'Article.id ASC'));
|
||||
$expected = array(array(
|
||||
|
@ -3259,7 +3259,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
array('comment' => 'Second Comment for Second Article', 'article_id' => 2)
|
||||
)
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Article->find('all', array('fields' => array('title', 'User.id', 'User.user'), 'limit' => 1, 'page' => 3, 'order' => 'Article.id ASC'));
|
||||
$expected = array(array(
|
||||
|
@ -3267,7 +3267,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
'User' => array('id' => 1, 'user' => 'mariano'),
|
||||
'Comment' => array()
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Article->contain(false, array('User' => array('fields' => 'user'), 'Comment'));
|
||||
$result = $this->Article->find('all');
|
||||
|
|
|
@ -107,7 +107,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
|
||||
$result = $TestModel->read(null, 1);
|
||||
$expected = array('TranslatedItem' => array('id' => 1, 'slug' => 'first_translated'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('fields' => array('slug')));
|
||||
$expected = array(
|
||||
|
@ -115,7 +115,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
array('TranslatedItem' => array('slug' => 'second_translated')),
|
||||
array('TranslatedItem' => array('slug' => 'third_translated'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,7 +147,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
array('id' => 6, 'locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'content', 'content' => 'Obsah #1')
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->hasMany['Title']['fields'] = $TestModel->hasMany['Content']['fields'] = array('content');
|
||||
$TestModel->hasMany['Title']['conditions']['locale'] = $TestModel->hasMany['Content']['conditions']['locale'] = 'eng';
|
||||
|
@ -170,7 +170,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
'Content' => array(array('foreign_key' => 3, 'content' => 'Content #3'))
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -195,7 +195,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
'content' => 'Content #1'
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all');
|
||||
$expected = array(
|
||||
|
@ -227,7 +227,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -253,7 +253,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('conditions' => "TranslatedItem.slug = 'first_translated'"));
|
||||
$expected = array(
|
||||
|
@ -267,7 +267,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -305,7 +305,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
array('id' => 6, 'locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'content', 'content' => 'Obsah #1')
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->hasMany['Title']['fields'] = $TestModel->hasMany['Content']['fields'] = array('content');
|
||||
$TestModel->hasMany['Title']['conditions']['locale'] = $TestModel->hasMany['Content']['conditions']['locale'] = 'eng';
|
||||
|
@ -328,7 +328,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
'Content' => array(array('foreign_key' => 3, 'content' => 'Content #3'))
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -354,7 +354,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
'content' => 'Inhalt #1'
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('fields' => array('slug', 'title', 'content')));
|
||||
$expected = array(
|
||||
|
@ -384,7 +384,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
);
|
||||
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,7 +412,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
'content' => ''
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -429,7 +429,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
$TestModel->displayField = 'title';
|
||||
$result = $TestModel->find('list', array('recursive' => 1));
|
||||
$expected = array(1 => 'Titel #1', 2 => 'Titel #2', 3 => 'Titel #3');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
// MSSQL trigger an error and stops the page even if the debug = 0
|
||||
if ($this->db instanceof Mssql) {
|
||||
|
@ -446,7 +446,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
|
||||
$result = $TestModel->find('list', array('recursive' => 1, 'callbacks' => 'before'));
|
||||
$expected = array(1 => null, 2 => null, 3 => null);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -466,10 +466,10 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
array('TranslatedItem' => array('slug' => 'second_translated', 'locale' => 'eng', 'content' => 'Content #2')),
|
||||
array('TranslatedItem' => array('slug' => 'third_translated', 'locale' => 'eng', 'content' => 'Content #3'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('fields' => array('TranslatedItem.slug', 'content')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->locale = array('eng', 'deu', 'cze');
|
||||
$delete = array(array('locale' => 'deu'), array('field' => 'content', 'locale' => 'eng'));
|
||||
|
@ -482,7 +482,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
array('TranslatedItem' => array('locale' => 'eng', 'title' => 'Title #2', 'content' => 'Obsah #2')),
|
||||
array('TranslatedItem' => array('locale' => 'eng', 'title' => 'Title #3', 'content' => 'Obsah #3'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -501,7 +501,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
$TestModel->save();
|
||||
$result = $TestModel->read();
|
||||
$expected = array('TranslatedItem' => array_merge($data, array('id' => $TestModel->id, 'locale' => 'spa')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -524,7 +524,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
$TestModel->save();
|
||||
$result = $TestModel->read(null, $id);
|
||||
$expected = array('TranslatedItem' => array_merge($oldData, $newData, array('locale' => 'spa')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -563,7 +563,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
array('id' => 20, 'locale' => 'spa', 'model' => 'TranslatedItem', 'foreign_key' => 4, 'field' => 'content', 'content' => 'Nuevo contenido')
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -603,7 +603,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
array('id' => 6, 'locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'content', 'content' => 'Novy Obsah #1')
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->unbindTranslation($translations);
|
||||
$TestModel->bindTranslation(array('title', 'content'), false);
|
||||
|
@ -648,7 +648,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
array('id' => 6, 'locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'content', 'content' => 'Upraveny obsah #1')
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -701,12 +701,12 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
|
||||
$result = array_keys($TestModel->hasMany);
|
||||
$expected = array('Title', 'Content');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->Behaviors->detach('Translate');
|
||||
$result = array_keys($TestModel->hasMany);
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = isset($TestModel->Behaviors->Translate);
|
||||
$this->assertFalse($result);
|
||||
|
@ -720,7 +720,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
$TestModel->Behaviors->attach('Translate', array('title' => 'Title', 'content' => 'Content'));
|
||||
$result = array_keys($TestModel->hasMany);
|
||||
$expected = array('Title', 'Content');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = isset($TestModel->Behaviors->Translate);
|
||||
$this->assertTrue($result);
|
||||
|
@ -755,7 +755,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
'content' => 'Another Content #1'
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -791,7 +791,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
'updated' => '2007-03-17 01:18:31'
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('recursive' => -1));
|
||||
$expected = array(
|
||||
|
@ -832,7 +832,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertEqual($TestModel->recursive, $recursive);
|
||||
|
||||
$TestModel->recursive = -1;
|
||||
|
@ -849,7 +849,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
'body' => 'Body (eng) #1'
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* testTranslateTableWithPrefix method
|
||||
|
@ -870,7 +870,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
'content' => 'Content #1',
|
||||
'title' => 'Title #1'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,7 +69,7 @@ class TreeBehaviorAfterTest extends CakeTestCase {
|
|||
|
||||
$expected = array('AfterTree' => array('name' => 'Six and One Half Changed in AfterTree::afterSave() but not in database', 'parent_id' => 6, 'lft' => 11, 'rght' => 12));
|
||||
$result = $this->Tree->save(array('AfterTree' => array('name' => 'Six and One Half', 'parent_id' => 6)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$expected = array('AfterTree' => array('name' => 'Six and One Half', 'parent_id' => 6, 'lft' => 11, 'rght' => 12, 'id' => 8));
|
||||
$result = $this->Tree->find('all');
|
||||
|
|
|
@ -292,7 +292,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$this->Tree->save(array($modelClass => array('name' => 'testAddOrphan', $parentField => null)));
|
||||
$result = $this->Tree->find('first', array('fields' => array('name', $parentField), 'order' => $modelClass . '.' . $leftField . ' desc'));
|
||||
$expected = array($modelClass => array('name' => 'testAddOrphan', $parentField => null));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$validTree = $this->Tree->verify();
|
||||
$this->assertIdentical($validTree, true);
|
||||
|
@ -315,7 +315,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$this->Tree->create();
|
||||
$result = $this->Tree->save(array($modelClass => array('name' => 'testAddMiddle', $parentField => $data[$modelClass]['id'])));
|
||||
$expected = array_merge(array($modelClass => array('name' => 'testAddMiddle', $parentField => '2')), $result);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$laterCount = $this->Tree->find('count');
|
||||
|
||||
|
@ -371,7 +371,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$this->Tree->save(array('name' => 'testAddNotIndexed', $parentField => null));
|
||||
$result = $this->Tree->find('first', array('fields' => array('name', $parentField), 'order' => $modelClass . '.' . $leftField . ' desc'));
|
||||
$expected = array($modelClass => array('name' => 'testAddNotIndexed', $parentField => null));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$validTree = $this->Tree->verify();
|
||||
$this->assertIdentical($validTree, true);
|
||||
|
@ -428,7 +428,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$expected = array(array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 5)),
|
||||
array($modelClass => array('id' => 5, 'name' => '1.2', $parentField => 1, $leftField => 6, $rightField => 11)),
|
||||
array($modelClass => array('id' => 3, 'name' => '1.1.1', $parentField => 1, $leftField => 12, $rightField => 13)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertTrue($this->Tree->verify());
|
||||
}
|
||||
|
||||
|
@ -616,7 +616,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(array($modelClass => array('name' => '1.2', )),
|
||||
array($modelClass => array('name' => '1.1', )));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -639,7 +639,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(array($modelClass => array('name' => '1.1', )),
|
||||
array($modelClass => array('name' => '1.2', )));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -670,7 +670,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
array($modelClass => array('name' => '1.8', )),
|
||||
array($modelClass => array('name' => '1.9', )),
|
||||
array($modelClass => array('name' => '1.10', )));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -701,7 +701,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
array($modelClass => array('name' => '1.8', )),
|
||||
array($modelClass => array('name' => '1.9', )),
|
||||
array($modelClass => array('name' => '1.10', )));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -723,7 +723,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(array($modelClass => array('name' => '1.2', )),
|
||||
array($modelClass => array('name' => '1.1', )));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -745,7 +745,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$result = $this->Tree->children(null, true, array('name'));
|
||||
$expected = array(array($modelClass => array('name' => '1.1', )),
|
||||
array($modelClass => array('name' => '1.2', )));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -776,7 +776,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
array($modelClass => array('name' => '1.9', )),
|
||||
array($modelClass => array('name' => '1.10', )),
|
||||
array($modelClass => array('name' => '1.5', )));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -807,7 +807,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
array($modelClass => array('name' => '1.8', )),
|
||||
array($modelClass => array('name' => '1.9', )),
|
||||
array($modelClass => array('name' => '1.10', )));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -838,7 +838,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
array($modelClass => array('name' => '1.8', )),
|
||||
array($modelClass => array('name' => '1.9', )),
|
||||
array($modelClass => array('name' => '1.10', )));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -863,7 +863,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$result = $this->Tree->find('all', array('fields' => 'name', 'order' => $modelClass . '.' . $leftField . ' ASC'));
|
||||
$expected = array(array($modelClass => array('name' => '1.1')),
|
||||
array($modelClass => array('name' => '1. Root')));
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1257,7 +1257,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Tree->generateTreeList();
|
||||
$expected = array(1 => '1. Root', 2 => '_1.1', 3 => '__1.1.1', 4 => '__1.1.2', 5 => '_1.2', 6 => '__1.2.1', 7 => '__1.2.2');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,7 +80,7 @@ class TreeBehaviorScopedTest extends CakeTestCase {
|
|||
array('FlagTree' => array('id' => '4', 'name' => '1.1.2', 'parent_id' => '2', 'lft' => '5', 'rght' => '6', 'flag' => '0')),
|
||||
array('FlagTree' => array('id' => '5', 'name' => '1.1.3', 'parent_id' => '2', 'lft' => '7', 'rght' => '8', 'flag' => '0'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Tree->Behaviors->attach('Tree', array('scope' => 'FlagTree.flag = 1'));
|
||||
$this->assertEqual($this->Tree->children(), array());
|
||||
|
@ -90,7 +90,7 @@ class TreeBehaviorScopedTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Tree->children();
|
||||
$expected = array(array('FlagTree' => array('id' => '2', 'name' => '1.1', 'parent_id' => '1', 'lft' => '2', 'rght' => '9', 'flag' => '1')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->assertTrue($this->Tree->delete());
|
||||
$this->assertEqual($this->Tree->find('count'), 11);
|
||||
|
@ -117,7 +117,7 @@ class TreeBehaviorScopedTest extends CakeTestCase {
|
|||
array('FlagTree' => array('id' => '4', 'name' => '1.1.2', 'parent_id' => '2', 'lft' => '5', 'rght' => '6', 'flag' => '0')),
|
||||
array('FlagTree' => array('id' => '5', 'name' => '1.1.3', 'parent_id' => '2', 'lft' => '7', 'rght' => '8', 'flag' => '0'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Tree->Behaviors->attach('Tree', array('scope' => array('FlagTree.flag' => 1)));
|
||||
$this->assertEqual($this->Tree->children(), array());
|
||||
|
@ -127,7 +127,7 @@ class TreeBehaviorScopedTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Tree->children();
|
||||
$expected = array(array('FlagTree' => array('id' => '2', 'name' => '1.1', 'parent_id' => '1', 'lft' => '2', 'rght' => '9', 'flag' => '1')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->assertTrue($this->Tree->delete());
|
||||
$this->assertEqual($this->Tree->find('count'), 11);
|
||||
|
@ -197,7 +197,7 @@ class TreeBehaviorScopedTest extends CakeTestCase {
|
|||
'flag' => 0,
|
||||
'locale' => 'eng',
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
//update existing record, same locale
|
||||
$this->Tree->create();
|
||||
|
@ -214,7 +214,7 @@ class TreeBehaviorScopedTest extends CakeTestCase {
|
|||
'flag' => 0,
|
||||
'locale' => 'eng',
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
//update different locale, same record
|
||||
$this->Tree->create();
|
||||
|
@ -239,7 +239,7 @@ class TreeBehaviorScopedTest extends CakeTestCase {
|
|||
'flag' => 0,
|
||||
'locale' => 'deu',
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
//Save with bindTranslation
|
||||
$this->Tree->locale = 'eng';
|
||||
|
@ -263,7 +263,7 @@ class TreeBehaviorScopedTest extends CakeTestCase {
|
|||
array('id' => 22, 'locale' => 'spa', 'model' => 'FlagTree', 'foreign_key' => 2, 'field' => 'name', 'content' => 'Nuevo leyenda')
|
||||
),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -319,6 +319,6 @@ class TreeBehaviorScopedTest extends CakeTestCase {
|
|||
'lft' => 1,
|
||||
'rght' => 2
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class TreeBehaviorUuidTest extends CakeTestCase {
|
|||
$expected = array(array($modelClass => array('name' => '1.1', $leftField => 2, $rightField => 5)),
|
||||
array($modelClass => array('name' => '1.2', $leftField => 6, $rightField => 11)),
|
||||
array($modelClass => array('name' => '1.1.1', $leftField => 12, $rightField => 13)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertTrue($this->Tree->verify());
|
||||
}
|
||||
|
||||
|
|
|
@ -625,11 +625,11 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
array('Apple' => array('id' => '3', 'name' => 'green blue', 'mytime' => '22:57:17'))
|
||||
);
|
||||
$result = $Apple->find('all', array('conditions' => array('Apple.id <' => '4')));
|
||||
$this->assertEqual($result, $expected2);
|
||||
$this->assertEqual($expected, $result2);
|
||||
|
||||
$Apple->Behaviors->disable('Test');
|
||||
$result = $Apple->find('all');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('beforeFind' => 'off', 'afterFind' => 'on'));
|
||||
$this->assertIdentical($Apple->find('all'), array());
|
||||
|
@ -697,11 +697,11 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
|
||||
$Apple->Child->Behaviors->attach('Test', array('before' => 'modify'));
|
||||
$result = $Apple->find('all', array('fields' => array('Apple.id'), 'conditions' => array('Apple.id <' => '4')));
|
||||
//$this->assertEqual($result, $expected2);
|
||||
//$this->assertEqual($expected, $result2);
|
||||
|
||||
$Apple->Child->Behaviors->disable('Test');
|
||||
$result = $Apple->find('all');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$Apple->Child->Behaviors->attach('Test', array('before' => 'off', 'after' => 'on'));
|
||||
//$this->assertIdentical($Apple->find('all'), array());
|
||||
|
@ -768,11 +768,11 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
'Child' => array())
|
||||
);
|
||||
$result = $Apple->find('all', array('fields' => array('Apple.id'), 'conditions' => array('Apple.id <' => '4')));
|
||||
//$this->assertEqual($result, $expected2);
|
||||
//$this->assertEqual($expected, $result2);
|
||||
|
||||
$Apple->Sample->Behaviors->disable('Test');
|
||||
$result = $Apple->find('all');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$Apple->Sample->Behaviors->attach('Test', array('before' => 'off', 'after' => 'on'));
|
||||
//$this->assertIdentical($Apple->find('all'), array());
|
||||
|
@ -837,11 +837,11 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
'fields' => array('Apple.id', 'Parent.id', 'Parent.name', 'Parent.mytime'),
|
||||
'conditions' => array('Apple.id <' => '4')
|
||||
));
|
||||
$this->assertEqual($result, $expected2);
|
||||
$this->assertEqual($expected, $result2);
|
||||
|
||||
$Apple->Parent->Behaviors->disable('Test');
|
||||
$result = $Apple->find('all');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$Apple->Parent->Behaviors->attach('Test', array('after' => 'off'));
|
||||
$this->assertEqual($Apple->find('all'), $expected);
|
||||
|
@ -1045,11 +1045,11 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
|
||||
$result = $Apple->{'look for the remote'}('in the couch');
|
||||
$expected = "Item.name = 'the remote' AND Location.name = 'the couch'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Apple->{'look for THE REMOTE'}('in the couch');
|
||||
$expected = "Item.name = 'THE REMOTE' AND Location.name = 'the couch'";
|
||||
$this->assertEqual($result, $expected, 'Mapped method was lowercased.');
|
||||
$this->assertEqual($expected, $result, 'Mapped method was lowercased.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -393,19 +393,19 @@ class DboMssqlTest extends CakeTestCase {
|
|||
|
||||
$result = $this->db->fields($this->model);
|
||||
$expected = $fields;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->db->clearFieldMappings();
|
||||
$result = $this->db->fields($this->model, null, 'MssqlTestModel.*');
|
||||
$expected = $fields;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->db->clearFieldMappings();
|
||||
$result = $this->db->fields($this->model, null, array('*', 'AnotherModel.id', 'AnotherModel.name'));
|
||||
$expected = array_merge($fields, array(
|
||||
'[AnotherModel].[id] AS [AnotherModel__18]',
|
||||
'[AnotherModel].[name] AS [AnotherModel__19]'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->db->clearFieldMappings();
|
||||
$result = $this->db->fields($this->model, null, array('*', 'MssqlClientTestModel.*'));
|
||||
|
@ -415,7 +415,7 @@ class DboMssqlTest extends CakeTestCase {
|
|||
'[MssqlClientTestModel].[email] AS [MssqlClientTestModel__20]',
|
||||
'CONVERT(VARCHAR(20), [MssqlClientTestModel].[created], 20) AS [MssqlClientTestModel__21]',
|
||||
'CONVERT(VARCHAR(20), [MssqlClientTestModel].[updated], 20) AS [MssqlClientTestModel__22]'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -427,11 +427,11 @@ class DboMssqlTest extends CakeTestCase {
|
|||
function testDistinctFields() {
|
||||
$result = $this->db->fields($this->model, null, array('DISTINCT Car.country_code'));
|
||||
$expected = array('DISTINCT [Car].[country_code] AS [Car__0]');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->db->fields($this->model, null, 'DISTINCT Car.country_code');
|
||||
$expected = array('DISTINCT [Car].[country_code] AS [Car__1]');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -479,7 +479,7 @@ class DboMssqlTest extends CakeTestCase {
|
|||
'length' => 4
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* testBuildColumn
|
||||
|
@ -490,53 +490,53 @@ class DboMssqlTest extends CakeTestCase {
|
|||
$column = array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary');
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[id] int IDENTITY (1, 1) NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$column = array('name' => 'client_id', 'type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11');
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[client_id] int DEFAULT 0 NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$column = array('name' => 'client_id', 'type' => 'integer', 'null' => true);
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[client_id] int NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
// 'name' => 'type' format for columns
|
||||
$column = array('type' => 'integer', 'name' => 'client_id');
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[client_id] int NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$column = array('type' => 'string', 'name' => 'name');
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[name] varchar(255) NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$column = array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255');
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[name] varchar(255) DEFAULT \'\' NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$column = array('name' => 'name', 'type' => 'string', 'null' => false, 'length' => '255');
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[name] varchar(255) NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$column = array('name' => 'name', 'type' => 'string', 'null' => false, 'default' => null, 'length' => '255');
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[name] varchar(255) NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$column = array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => null, 'length' => '255');
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[name] varchar(255) NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$column = array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => '', 'length' => '255');
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[name] varchar(255) DEFAULT \'\'';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* testBuildIndex method
|
||||
|
@ -553,7 +553,7 @@ class DboMssqlTest extends CakeTestCase {
|
|||
'PRIMARY KEY ([id])',
|
||||
'ALTER TABLE items ADD CONSTRAINT client_id UNIQUE([client_id]);'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$indexes = array('client_id' => array('column' => 'client_id'));
|
||||
$result = $this->db->buildIndex($indexes, 'items');
|
||||
|
@ -562,7 +562,7 @@ class DboMssqlTest extends CakeTestCase {
|
|||
$indexes = array('client_id' => array('column' => array('client_id', 'period_id'), 'unique' => 1));
|
||||
$result = $this->db->buildIndex($indexes, 'items');
|
||||
$expected = array('ALTER TABLE items ADD CONSTRAINT client_id UNIQUE([client_id], [period_id]);');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* testUpdateAllSyntax method
|
||||
|
@ -620,7 +620,7 @@ class DboMssqlTest extends CakeTestCase {
|
|||
'INSERT INTO [mssql_test_models] ([id], [name], [login]) VALUES (2, \'Renan\', \'renan.saddam\')',
|
||||
'SET IDENTITY_INSERT [mssql_test_models] OFF'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$fields = array('name', 'login');
|
||||
$values = array('(\'Larry\', \'PhpNut\')', '(\'Renan\', \'renan.saddam\')');
|
||||
|
@ -631,7 +631,7 @@ class DboMssqlTest extends CakeTestCase {
|
|||
'INSERT INTO [mssql_test_models] ([name], [login]) VALUES (\'Larry\', \'PhpNut\')',
|
||||
'INSERT INTO [mssql_test_models] ([name], [login]) VALUES (\'Renan\', \'renan.saddam\')'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* testLastError
|
||||
|
|
|
@ -108,7 +108,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'`MysqlTestModel`.`created`',
|
||||
'`MysqlTestModel`.`updated`'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$expected = 1.2;
|
||||
$result = $this->Dbo->value(1.2, 'float');
|
||||
|
@ -283,7 +283,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '`testName` DEFAULT NULL COMMENT \'test\'';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'testName',
|
||||
|
@ -296,7 +296,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '`testName` CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->Dbo->columns = $restore;
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'pointless_small_int' => array('column' => 'small_int', 'unique' => 0),
|
||||
'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -413,43 +413,43 @@ class DboMysqlTest extends CakeTestCase {
|
|||
public function testColumn() {
|
||||
$result = $this->Dbo->column('varchar(50)');
|
||||
$expected = 'string';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->column('text');
|
||||
$expected = 'text';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->column('int(11)');
|
||||
$expected = 'integer';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->column('int(11) unsigned');
|
||||
$expected = 'integer';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->column('tinyint(1)');
|
||||
$expected = 'boolean';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->column('boolean');
|
||||
$expected = 'boolean';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->column('float');
|
||||
$expected = 'float';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->column('float unsigned');
|
||||
$expected = 'float';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->column('double unsigned');
|
||||
$expected = 'float';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->column('decimal(14,7) unsigned');
|
||||
$expected = 'float';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -618,7 +618,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
$this->assertEqual($result['Collation'], 'utf8_general_ci');
|
||||
$this->assertEqual($result['Engine'], 'InnoDB');
|
||||
$this->assertEqual($result['charset'], 'utf8');
|
||||
|
||||
|
||||
$this->Dbo->rawQuery($this->Dbo->dropSchema($schema1));
|
||||
}
|
||||
|
||||
|
@ -673,7 +673,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'charset' => 'utf8',
|
||||
'collate' => 'utf8_unicode_ci',
|
||||
'engine' => 'InnoDB');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$table = $this->Dbo->fullTableName($tableName);
|
||||
$this->Dbo->rawQuery('CREATE TABLE ' . $table . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_ci;');
|
||||
|
@ -683,7 +683,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'charset' => 'cp1250',
|
||||
'collate' => 'cp1250_general_ci',
|
||||
'engine' => 'MyISAM');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -703,7 +703,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'DEFAULT CHARSET=utf8',
|
||||
'COLLATE=utf8_unicode_ci',
|
||||
'ENGINE=InnoDB');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -736,7 +736,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
$result = $this->Dbo->fields($model, null, array('data', 'other__field'));
|
||||
|
||||
$expected = array('`BinaryTest`.`data`', '(SUM(id)) AS `BinaryTest_$_other__field`');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1765,7 +1765,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
$this->Model = new TestModel4();
|
||||
$result = $this->Dbo->fields($this->Model, 'Vendor', "DISTINCT Vendor.id, Vendor.name");
|
||||
$expected = array('DISTINCT `Vendor`.`id`', '`Vendor`.`name`');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1777,112 +1777,112 @@ class DboMysqlTest extends CakeTestCase {
|
|||
function testStringConditionsParsing() {
|
||||
$result = $this->Dbo->conditions("ProjectBid.project_id = Project.id");
|
||||
$expected = " WHERE `ProjectBid`.`project_id` = `Project`.`id`";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("Candy.name LIKE 'a' AND HardCandy.name LIKE 'c'");
|
||||
$expected = " WHERE `Candy`.`name` LIKE 'a' AND `HardCandy`.`name` LIKE 'c'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("HardCandy.name LIKE 'a' AND Candy.name LIKE 'c'");
|
||||
$expected = " WHERE `HardCandy`.`name` LIKE 'a' AND `Candy`.`name` LIKE 'c'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("Post.title = '1.1'");
|
||||
$expected = " WHERE `Post`.`title` = '1.1'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("User.id != 0 AND User.user LIKE '%arr%'");
|
||||
$expected = " WHERE `User`.`id` != 0 AND `User`.`user` LIKE '%arr%'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("SUM(Post.comments_count) > 500");
|
||||
$expected = " WHERE SUM(`Post`.`comments_count`) > 500";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("(Post.created < '" . date('Y-m-d H:i:s') . "') GROUP BY YEAR(Post.created), MONTH(Post.created)");
|
||||
$expected = " WHERE (`Post`.`created` < '" . date('Y-m-d H:i:s') . "') GROUP BY YEAR(`Post`.`created`), MONTH(`Post`.`created`)";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("score BETWEEN 90.1 AND 95.7");
|
||||
$expected = " WHERE score BETWEEN 90.1 AND 95.7";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('score' => array(2=>1, 2, 10)));
|
||||
$expected = " WHERE score IN (1, 2, 10)";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("Aro.rght = Aro.lft + 1.1");
|
||||
$expected = " WHERE `Aro`.`rght` = `Aro`.`lft` + 1.1";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("(Post.created < '" . date('Y-m-d H:i:s') . "') GROUP BY YEAR(Post.created), MONTH(Post.created)");
|
||||
$expected = " WHERE (`Post`.`created` < '" . date('Y-m-d H:i:s') . "') GROUP BY YEAR(`Post`.`created`), MONTH(`Post`.`created`)";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('Sportstaette.sportstaette LIKE "%ru%" AND Sportstaette.sportstaettenart_id = 2');
|
||||
$expected = ' WHERE `Sportstaette`.`sportstaette` LIKE "%ru%" AND `Sportstaette`.`sportstaettenart_id` = 2';
|
||||
$this->assertPattern('/\s*WHERE\s+`Sportstaette`\.`sportstaette`\s+LIKE\s+"%ru%"\s+AND\s+`Sports/', $result);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('Sportstaette.sportstaettenart_id = 2 AND Sportstaette.sportstaette LIKE "%ru%"');
|
||||
$expected = ' WHERE `Sportstaette`.`sportstaettenart_id` = 2 AND `Sportstaette`.`sportstaette` LIKE "%ru%"';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('SUM(Post.comments_count) > 500 AND NOT Post.title IS NULL AND NOT Post.extended_title IS NULL');
|
||||
$expected = ' WHERE SUM(`Post`.`comments_count`) > 500 AND NOT `Post`.`title` IS NULL AND NOT `Post`.`extended_title` IS NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('NOT Post.title IS NULL AND NOT Post.extended_title IS NULL AND SUM(Post.comments_count) > 500');
|
||||
$expected = ' WHERE NOT `Post`.`title` IS NULL AND NOT `Post`.`extended_title` IS NULL AND SUM(`Post`.`comments_count`) > 500';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('NOT Post.extended_title IS NULL AND NOT Post.title IS NULL AND Post.title != "" AND SPOON(SUM(Post.comments_count) + 1.1) > 500');
|
||||
$expected = ' WHERE NOT `Post`.`extended_title` IS NULL AND NOT `Post`.`title` IS NULL AND `Post`.`title` != "" AND SPOON(SUM(`Post`.`comments_count`) + 1.1) > 500';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('NOT Post.title_extended IS NULL AND NOT Post.title IS NULL AND Post.title_extended != Post.title');
|
||||
$expected = ' WHERE NOT `Post`.`title_extended` IS NULL AND NOT `Post`.`title` IS NULL AND `Post`.`title_extended` != `Post`.`title`';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("Comment.id = 'a'");
|
||||
$expected = " WHERE `Comment`.`id` = 'a'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("lower(Article.title) LIKE 'a%'");
|
||||
$expected = " WHERE lower(`Article`.`title`) LIKE 'a%'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('((MATCH(Video.title) AGAINST(\'My Search*\' IN BOOLEAN MODE) * 2) + (MATCH(Video.description) AGAINST(\'My Search*\' IN BOOLEAN MODE) * 0.4) + (MATCH(Video.tags) AGAINST(\'My Search*\' IN BOOLEAN MODE) * 1.5))');
|
||||
$expected = ' WHERE ((MATCH(`Video`.`title`) AGAINST(\'My Search*\' IN BOOLEAN MODE) * 2) + (MATCH(`Video`.`description`) AGAINST(\'My Search*\' IN BOOLEAN MODE) * 0.4) + (MATCH(`Video`.`tags`) AGAINST(\'My Search*\' IN BOOLEAN MODE) * 1.5))';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('DATEDIFF(NOW(),Article.published) < 1 && Article.live=1');
|
||||
$expected = " WHERE DATEDIFF(NOW(),`Article`.`published`) < 1 && `Article`.`live`=1";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('file = "index.html"');
|
||||
$expected = ' WHERE file = "index.html"';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions("file = 'index.html'");
|
||||
$expected = " WHERE file = 'index.html'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$letter = $letter = 'd.a';
|
||||
$conditions = array('Company.name like ' => $letter . '%');
|
||||
$result = $this->Dbo->conditions($conditions);
|
||||
$expected = " WHERE `Company`.`name` like 'd.a%'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$conditions = array('Artist.name' => 'JUDY and MARY');
|
||||
$result = $this->Dbo->conditions($conditions);
|
||||
$expected = " WHERE `Artist`.`name` = 'JUDY and MARY'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$conditions = array('Artist.name' => 'JUDY AND MARY');
|
||||
$result = $this->Dbo->conditions($conditions);
|
||||
$expected = " WHERE `Artist`.`name` = 'JUDY AND MARY'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1894,20 +1894,20 @@ class DboMysqlTest extends CakeTestCase {
|
|||
function testQuotesInStringConditions() {
|
||||
$result = $this->Dbo->conditions('Member.email = \'mariano@cricava.com\'');
|
||||
$expected = ' WHERE `Member`.`email` = \'mariano@cricava.com\'';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('Member.email = "mariano@cricava.com"');
|
||||
$expected = ' WHERE `Member`.`email` = "mariano@cricava.com"';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions('Member.email = \'mariano@cricava.com\' AND Member.user LIKE \'mariano.iglesias%\'');
|
||||
$expected = ' WHERE `Member`.`email` = \'mariano@cricava.com\' AND `Member`.`user` LIKE \'mariano.iglesias%\'';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
|
||||
$result = $this->Dbo->conditions('Member.email = "mariano@cricava.com" AND Member.user LIKE "mariano.iglesias%"');
|
||||
$expected = ' WHERE `Member`.`email` = "mariano@cricava.com" AND `Member`.`user` LIKE "mariano.iglesias%"';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2026,67 +2026,67 @@ class DboMysqlTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Dbo->conditions(array('HardCandy.name LIKE' => 'a', 'Candy.name LIKE' => 'c'));
|
||||
$expected = " WHERE `HardCandy`.`name` LIKE 'a' AND `Candy`.`name` LIKE 'c'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('HardCandy.name LIKE' => 'a%', 'Candy.name LIKE' => '%c%'));
|
||||
$expected = " WHERE `HardCandy`.`name` LIKE 'a%' AND `Candy`.`name` LIKE '%c%'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('HardCandy.name LIKE' => 'to be or%', 'Candy.name LIKE' => '%not to be%'));
|
||||
$expected = " WHERE `HardCandy`.`name` LIKE 'to be or%' AND `Candy`.`name` LIKE '%not to be%'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('score BETWEEN ? AND ?' => array(90.1, 95.7)));
|
||||
$expected = " WHERE `score` BETWEEN 90.100000 AND 95.700000";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Post.title' => 1.1));
|
||||
$expected = " WHERE `Post`.`title` = 1.100000";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Post.title' => 1.1), true, true, new Post());
|
||||
$expected = " WHERE `Post`.`title` = '1.1'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('SUM(Post.comments_count) >' => '500'));
|
||||
$expected = " WHERE SUM(`Post`.`comments_count`) > '500'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('MAX(Post.rating) >' => '50'));
|
||||
$expected = " WHERE MAX(`Post`.`rating`) > '50'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('title LIKE' => '%hello'));
|
||||
$expected = " WHERE `title` LIKE '%hello'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Post.name' => 'mad(g)ik'));
|
||||
$expected = " WHERE `Post`.`name` = 'mad(g)ik'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('score' => array(1, 2, 10)));
|
||||
$expected = " WHERE score IN (1, 2, 10)";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('score' => array()));
|
||||
$expected = " WHERE `score` IS NULL";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('score !=' => array()));
|
||||
$expected = " WHERE `score` IS NOT NULL";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('score !=' => '20'));
|
||||
$expected = " WHERE `score` != '20'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('score >' => '20'));
|
||||
$expected = " WHERE `score` > '20'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('client_id >' => '20'), true, true, new TestModel());
|
||||
$expected = " WHERE `client_id` > 20";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('OR' => array(
|
||||
array('User.user' => 'mariano'),
|
||||
|
@ -2094,63 +2094,63 @@ class DboMysqlTest extends CakeTestCase {
|
|||
)));
|
||||
|
||||
$expected = " WHERE ((`User`.`user` = 'mariano') OR (`User`.`user` = 'nate'))";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('or' => array(
|
||||
'score BETWEEN ? AND ?' => array('4', '5'), 'rating >' => '20'
|
||||
)));
|
||||
$expected = " WHERE ((`score` BETWEEN '4' AND '5') OR (`rating` > '20'))";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('or' => array(
|
||||
'score BETWEEN ? AND ?' => array('4', '5'), array('score >' => '20')
|
||||
)));
|
||||
$expected = " WHERE ((`score` BETWEEN '4' AND '5') OR (`score` > '20'))";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('and' => array(
|
||||
'score BETWEEN ? AND ?' => array('4', '5'), array('score >' => '20')
|
||||
)));
|
||||
$expected = " WHERE ((`score` BETWEEN '4' AND '5') AND (`score` > '20'))";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array(
|
||||
'published' => 1, 'or' => array('score >' => '2', array('score >' => '20'))
|
||||
));
|
||||
$expected = " WHERE `published` = 1 AND ((`score` > '2') OR (`score` > '20'))";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array(array('Project.removed' => false)));
|
||||
$expected = " WHERE `Project`.`removed` = '0'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array(array('Project.removed' => true)));
|
||||
$expected = " WHERE `Project`.`removed` = '1'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array(array('Project.removed' => null)));
|
||||
$expected = " WHERE `Project`.`removed` IS NULL";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array(array('Project.removed !=' => null)));
|
||||
$expected = " WHERE `Project`.`removed` IS NOT NULL";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('(Usergroup.permissions) & 4' => 4));
|
||||
$expected = " WHERE (`Usergroup`.`permissions`) & 4 = 4";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('((Usergroup.permissions) & 4)' => 4));
|
||||
$expected = " WHERE ((`Usergroup`.`permissions`) & 4) = 4";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Post.modified >=' => 'DATE_SUB(NOW(), INTERVAL 7 DAY)'));
|
||||
$expected = " WHERE `Post`.`modified` >= 'DATE_SUB(NOW(), INTERVAL 7 DAY)'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Post.modified >= DATE_SUB(NOW(), INTERVAL 7 DAY)'));
|
||||
$expected = " WHERE `Post`.`modified` >= DATE_SUB(NOW(), INTERVAL 7 DAY)";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array(
|
||||
'NOT' => array('Course.id' => null, 'Course.vet' => 'N', 'level_of_education_id' => array(912,999)),
|
||||
|
@ -2163,7 +2163,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Dbo->conditions(array('TestModel.field =' => 'gribe$@()lu'));
|
||||
$expected = " WHERE `TestModel`.`field` = 'gribe$@()lu'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$conditions['NOT'] = array('Listing.expiration BETWEEN ? AND ?' => array("1", "100"));
|
||||
$conditions[0]['OR'] = array(
|
||||
|
@ -2178,69 +2178,69 @@ class DboMysqlTest extends CakeTestCase {
|
|||
$expected = " WHERE NOT (`Listing`.`expiration` BETWEEN '1' AND '100') AND" .
|
||||
" ((`Listing`.`title` LIKE '%term%') OR (`Listing`.`description` LIKE '%term%')) AND" .
|
||||
" ((`Listing`.`title` LIKE '%term_2%') OR (`Listing`.`description` LIKE '%term_2%'))";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('MD5(CONCAT(Reg.email,Reg.id))' => 'blah'));
|
||||
$expected = " WHERE MD5(CONCAT(`Reg`.`email`,`Reg`.`id`)) = 'blah'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array(
|
||||
'MD5(CONCAT(Reg.email,Reg.id))' => array('blah', 'blahblah')
|
||||
));
|
||||
$expected = " WHERE MD5(CONCAT(`Reg`.`email`,`Reg`.`id`)) IN ('blah', 'blahblah')";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$conditions = array('id' => array(2, 5, 6, 9, 12, 45, 78, 43, 76));
|
||||
$result = $this->Dbo->conditions($conditions);
|
||||
$expected = " WHERE id IN (2, 5, 6, 9, 12, 45, 78, 43, 76)";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$conditions = array('title' => 'user(s)');
|
||||
$result = $this->Dbo->conditions($conditions);
|
||||
$expected = " WHERE `title` = 'user(s)'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$conditions = array('title' => 'user(s) data');
|
||||
$result = $this->Dbo->conditions($conditions);
|
||||
$expected = " WHERE `title` = 'user(s) data'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$conditions = array('title' => 'user(s,arg) data');
|
||||
$result = $this->Dbo->conditions($conditions);
|
||||
$expected = " WHERE `title` = 'user(s,arg) data'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array("Book.book_name" => 'Java(TM)'));
|
||||
$expected = " WHERE `Book`.`book_name` = 'Java(TM)'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array("Book.book_name" => 'Java(TM) '));
|
||||
$expected = " WHERE `Book`.`book_name` = 'Java(TM) '";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array("Book.id" => 0));
|
||||
$expected = " WHERE `Book`.`id` = 0";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array("Book.id" => NULL));
|
||||
$expected = " WHERE `Book`.`id` IS NULL";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Listing.beds >=' => 0));
|
||||
$expected = " WHERE `Listing`.`beds` >= 0";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array(
|
||||
'ASCII(SUBSTRING(keyword, 1, 1)) BETWEEN ? AND ?' => array(65, 90)
|
||||
));
|
||||
$expected = ' WHERE ASCII(SUBSTRING(keyword, 1, 1)) BETWEEN 65 AND 90';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('or' => array(
|
||||
'? BETWEEN Model.field1 AND Model.field2' => '2009-03-04'
|
||||
)));
|
||||
$expected = " WHERE '2009-03-04' BETWEEN Model.field1 AND Model.field2";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2254,19 +2254,19 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'CAST(Book.created AS DATE)' => '2008-08-02'
|
||||
));
|
||||
$expected = " WHERE CAST(`Book`.`created` AS DATE) = '2008-08-02'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array(
|
||||
'CAST(Book.created AS DATE) <=' => '2008-08-02'
|
||||
));
|
||||
$expected = " WHERE CAST(`Book`.`created` AS DATE) <= '2008-08-02'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array(
|
||||
'(Stats.clicks * 100) / Stats.views >' => 50
|
||||
));
|
||||
$expected = " WHERE (`Stats`.`clicks` * 100) / `Stats`.`views` > 50";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2280,7 +2280,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
$conditions[] = array('User.last_name' => 'Lastname');
|
||||
$result = $this->Dbo->conditions($conditions);
|
||||
$expected = " WHERE `User`.`first_name` = 'Firstname' AND `User`.`last_name` = 'Lastname'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$conditions = array(
|
||||
'Thread.project_id' => 5,
|
||||
|
@ -2316,27 +2316,27 @@ class DboMysqlTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Dbo->conditions(array('Article2.viewed >=' => 0), true, true, $this->Model);
|
||||
$expected = " WHERE `Article2`.`viewed` >= 0";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Article2.viewed >=' => '0'), true, true, $this->Model);
|
||||
$expected = " WHERE `Article2`.`viewed` >= 0";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Article2.viewed >=' => '1'), true, true, $this->Model);
|
||||
$expected = " WHERE `Article2`.`viewed` >= 1";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Article2.rate_sum BETWEEN ? AND ?' => array(0, 10)), true, true, $this->Model);
|
||||
$expected = " WHERE `Article2`.`rate_sum` BETWEEN 0 AND 10";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Article2.rate_sum BETWEEN ? AND ?' => array('0', '10')), true, true, $this->Model);
|
||||
$expected = " WHERE `Article2`.`rate_sum` BETWEEN 0 AND 10";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->conditions(array('Article2.rate_sum BETWEEN ? AND ?' => array('1', '10')), true, true, $this->Model);
|
||||
$expected = " WHERE `Article2`.`rate_sum` BETWEEN 1 AND 10";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2349,15 +2349,15 @@ class DboMysqlTest extends CakeTestCase {
|
|||
$this->Model = new TestModel();
|
||||
$result = $this->Dbo->fields($this->Model, 'Vendor', "Vendor.id, COUNT(Model.vendor_id) AS `Vendor`.`count`");
|
||||
$expected = array('`Vendor`.`id`', 'COUNT(`Model`.`vendor_id`) AS `Vendor`.`count`');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, 'Vendor', "`Vendor`.`id`, COUNT(`Model`.`vendor_id`) AS `Vendor`.`count`");
|
||||
$expected = array('`Vendor`.`id`', 'COUNT(`Model`.`vendor_id`) AS `Vendor`.`count`');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, 'Post', "CONCAT(REPEAT(' ', COUNT(Parent.name) - 1), Node.name) AS name, Node.created");
|
||||
$expected = array("CONCAT(REPEAT(' ', COUNT(`Parent`.`name`) - 1), Node.name) AS name", "`Node`.`created`");
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, 'round( (3.55441 * fooField), 3 ) AS test');
|
||||
$this->assertEqual($result, array('round( (3.55441 * fooField), 3 ) AS test'));
|
||||
|
@ -2370,18 +2370,18 @@ class DboMysqlTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Dbo->fields($this->Model, 'Post', "Node.created, CONCAT(REPEAT(' ', COUNT(Parent.name) - 1), Node.name) AS name");
|
||||
$expected = array("`Node`.`created`", "CONCAT(REPEAT(' ', COUNT(`Parent`.`name`) - 1), Node.name) AS name");
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, 'Post', "2.2,COUNT(*), SUM(Something.else) as sum, Node.created, CONCAT(REPEAT(' ', COUNT(Parent.name) - 1), Node.name) AS name,Post.title,Post.1,1.1");
|
||||
$expected = array(
|
||||
'2.2', 'COUNT(*)', 'SUM(`Something`.`else`) as sum', '`Node`.`created`',
|
||||
"CONCAT(REPEAT(' ', COUNT(`Parent`.`name`) - 1), Node.name) AS name", '`Post`.`title`', '`Post`.`1`', '1.1'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, "(`Provider`.`star_total` / `Provider`.`total_ratings`) as `rating`");
|
||||
$expected = array("(`Provider`.`star_total` / `Provider`.`total_ratings`) as `rating`");
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, 'Post');
|
||||
$expected = array(
|
||||
|
@ -2391,7 +2391,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'`Post`.`url`', '`Post`.`email`', '`Post`.`comments`', '`Post`.`last_login`',
|
||||
'`Post`.`created`', '`Post`.`updated`'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, 'Other');
|
||||
$expected = array(
|
||||
|
@ -2401,27 +2401,27 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'`Other`.`url`', '`Other`.`email`', '`Other`.`comments`', '`Other`.`last_login`',
|
||||
'`Other`.`created`', '`Other`.`updated`'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, array(), false);
|
||||
$expected = array('id', 'client_id', 'name', 'login', 'passwd', 'addr_1', 'addr_2', 'zip_code', 'city', 'country', 'phone', 'fax', 'url', 'email', 'comments', 'last_login', 'created', 'updated');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, 'COUNT(*)');
|
||||
$expected = array('COUNT(*)');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, 'SUM(Thread.unread_buyer) AS ' . $this->Dbo->name('sum_unread_buyer'));
|
||||
$expected = array('SUM(`Thread`.`unread_buyer`) AS `sum_unread_buyer`');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, 'name, count(*)');
|
||||
$expected = array('`TestModel`.`name`', 'count(*)');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, 'count(*), name');
|
||||
$expected = array('count(*)', '`TestModel`.`name`');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields(
|
||||
$this->Model, null, 'field1, field2, field3, count(*), name'
|
||||
|
@ -2430,29 +2430,29 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'`TestModel`.`field1`', '`TestModel`.`field2`',
|
||||
'`TestModel`.`field3`', 'count(*)', '`TestModel`.`name`'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, array('dayofyear(now())'));
|
||||
$expected = array('dayofyear(now())');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, array('MAX(Model.field) As Max'));
|
||||
$expected = array('MAX(`Model`.`field`) As Max');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, array('Model.field AS AnotherName'));
|
||||
$expected = array('`Model`.`field` AS `AnotherName`');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, array('field AS AnotherName'));
|
||||
$expected = array('`field` AS `AnotherName`');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, null, array(
|
||||
'TestModel.field AS AnotherName'
|
||||
));
|
||||
$expected = array('`TestModel`.`field` AS `AnotherName`');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->Model, 'Foo', array(
|
||||
'id', 'title', '(user_count + discussion_count + post_count) AS score'
|
||||
|
@ -2462,7 +2462,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'`Foo`.`title`',
|
||||
'(user_count + discussion_count + post_count) AS score'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2478,7 +2478,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'`TestModel`.`id`',
|
||||
"CASE Sample.id WHEN 1 THEN 'Id One' ELSE 'Other Id' END AS case_col"
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2537,7 +2537,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
function testOrderParsing() {
|
||||
$result = $this->Dbo->order("ADDTIME(Event.time_begin, '-06:00:00') ASC");
|
||||
$expected = " ORDER BY ADDTIME(`Event`.`time_begin`, '-06:00:00') ASC";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->order("title, id");
|
||||
$this->assertPattern('/^\s*ORDER BY\s+`title`\s+ASC,\s+`id`\s+ASC\s*$/', $result);
|
||||
|
@ -2568,7 +2568,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Dbo->order("Dealer.id = 7 desc, Dealer.id = 3 desc, Dealer.title asc");
|
||||
$expected = " ORDER BY `Dealer`.`id` = 7 desc, `Dealer`.`id` = 3 desc, `Dealer`.`title` asc";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->order(array("Page.name" => "='test' DESC"));
|
||||
$this->assertPattern("/^\s*ORDER BY\s+`Page`\.`name`\s*='test'\s+DESC\s*$/", $result);
|
||||
|
@ -2593,15 +2593,15 @@ class DboMysqlTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Dbo->order("Anuncio.destaque & 2 DESC");
|
||||
$expected = ' ORDER BY `Anuncio`.`destaque` & 2 DESC';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->order("3963.191 * id");
|
||||
$expected = ' ORDER BY 3963.191 * id ASC';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->order(array('Property.sale_price IS NULL'));
|
||||
$expected = ' ORDER BY `Property`.`sale_price` IS NULL ASC';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2666,27 +2666,27 @@ class DboMysqlTest extends CakeTestCase {
|
|||
function testLength() {
|
||||
$result = $this->Dbo->length('varchar(255)');
|
||||
$expected = 255;
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $this->Dbo->length('int(11)');
|
||||
$expected = 11;
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $this->Dbo->length('float(5,3)');
|
||||
$expected = '5,3';
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $this->Dbo->length('decimal(5,2)');
|
||||
$expected = '5,2';
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $this->Dbo->length("enum('test','me','now')");
|
||||
$expected = 4;
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $this->Dbo->length("set('a','b','cd')");
|
||||
$expected = 2;
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$this->expectError();
|
||||
$result = $this->Dbo->length(false);
|
||||
|
@ -2694,11 +2694,11 @@ class DboMysqlTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Dbo->length('datetime');
|
||||
$expected = null;
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $this->Dbo->length('text');
|
||||
$expected = null;
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2713,21 +2713,21 @@ class DboMysqlTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildIndex($data);
|
||||
$expected = array('PRIMARY KEY (`id`)');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'MyIndex' => array('column' => 'id', 'unique' => true)
|
||||
);
|
||||
$result = $this->Dbo->buildIndex($data);
|
||||
$expected = array('UNIQUE KEY `MyIndex` (`id`)');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'MyIndex' => array('column' => array('id', 'name'), 'unique' => true)
|
||||
);
|
||||
$result = $this->Dbo->buildIndex($data);
|
||||
$expected = array('UNIQUE KEY `MyIndex` (`id`, `name`)');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2757,7 +2757,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '`testName` varchar(255) DEFAULT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'int_field',
|
||||
|
@ -2770,7 +2770,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
$this->Dbo->columns = array('integer' => array('name' => 'int', 'limit' => '11', 'formatter' => 'intval'), );
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '`int_field` int(11) NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Dbo->fieldParameters['param'] = array(
|
||||
'value' => 'COLLATE',
|
||||
|
@ -2789,7 +2789,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '`int_field` int(11) NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'int_field',
|
||||
|
@ -2800,7 +2800,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '`int_field` int(11) COLLATE GOOD NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Dbo->columns = $restore;
|
||||
|
||||
|
@ -2812,7 +2812,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '`created` timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'created',
|
||||
|
@ -2822,7 +2822,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '`created` timestamp DEFAULT CURRENT_TIMESTAMP';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'modified',
|
||||
|
@ -2831,7 +2831,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '`modified` timestamp NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'modified',
|
||||
|
@ -2841,7 +2841,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '`modified` timestamp NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2867,7 +2867,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
|
||||
$this->Dbo->hasAny($this->Model, array('TestModel.name' => 'harry'));
|
||||
$this->Dbo->hasAny($this->Model, array());
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3143,7 +3143,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
$commentTable = $this->Dbo->fullTableName('comments');
|
||||
$Article = ClassRegistry::init('Article');
|
||||
$Article->virtualFields = array(
|
||||
'comment_count' => 'SELECT COUNT(*) FROM ' . $commentTable .
|
||||
'comment_count' => 'SELECT COUNT(*) FROM ' . $commentTable .
|
||||
' AS Comment WHERE Article.id = Comment.article_id'
|
||||
);
|
||||
$result = $Article->find('all');
|
||||
|
@ -3345,7 +3345,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'color' => 'Red 1',
|
||||
'name' => 'Red Apple 1'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fetchAll('SELECT name FROM ' . $this->Dbo->fullTableName('apples') . ' ORDER BY id');
|
||||
$expected = array(
|
||||
|
@ -3357,14 +3357,14 @@ class DboMysqlTest extends CakeTestCase {
|
|||
array($this->Dbo->fullTableName('apples', false) => array('name' => 'My new apple')),
|
||||
array($this->Dbo->fullTableName('apples', false) => array('name' => 'Some odd color'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->field($this->Dbo->fullTableName('apples', false), 'SELECT color, name FROM ' . $this->Dbo->fullTableName('apples') . ' ORDER BY id');
|
||||
$expected = array(
|
||||
'color' => 'Red 1',
|
||||
'name' => 'Red Apple 1'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$Apple->unbindModel(array(), false);
|
||||
$result = $this->Dbo->read($Apple, array(
|
||||
|
@ -3381,7 +3381,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
array('Apple' => array('name' => 'My new apple')),
|
||||
array('Apple' => array('name' => 'Some odd color'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->read($Article, array(
|
||||
'fields' => array('id', 'user_id', 'title'),
|
||||
|
|
|
@ -285,17 +285,17 @@ class DboPostgresTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Dbo->fields($this->model);
|
||||
$expected = $fields;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->model, null, 'PostgresTestModel.*');
|
||||
$expected = $fields;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->model, null, array('*', 'AnotherModel.id', 'AnotherModel.name'));
|
||||
$expected = array_merge($fields, array(
|
||||
'"AnotherModel"."id" AS "AnotherModel__id"',
|
||||
'"AnotherModel"."name" AS "AnotherModel__name"'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($this->model, null, array('*', 'PostgresClientTestModel.*'));
|
||||
$expected = array_merge($fields, array(
|
||||
|
@ -304,7 +304,7 @@ class DboPostgresTest extends CakeTestCase {
|
|||
'"PostgresClientTestModel"."email" AS "PostgresClientTestModel__email"',
|
||||
'"PostgresClientTestModel"."created" AS "PostgresClientTestModel__created"',
|
||||
'"PostgresClientTestModel"."updated" AS "PostgresClientTestModel__updated"'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -792,7 +792,7 @@ class DboPostgresTest extends CakeTestCase {
|
|||
function testOrderAdditionalParams() {
|
||||
$result = $this->Dbo->order(array('title' => 'DESC NULLS FIRST', 'body' => 'DESC'));
|
||||
$expected = ' ORDER BY "title" DESC NULLS FIRST, "body" DESC';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -803,15 +803,15 @@ class DboPostgresTest extends CakeTestCase {
|
|||
$Article = new Article;
|
||||
$result = $this->Dbo->fields($Article, null, array('COUNT(DISTINCT Article.id)'));
|
||||
$expected = array('COUNT(DISTINCT "Article"."id")');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($Article, null, array('COUNT(DISTINCT id)'));
|
||||
$expected = array('COUNT(DISTINCT "id")');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Dbo->fields($Article, null, array('COUNT(DISTINCT FUNC(id))'));
|
||||
$expected = array('COUNT(DISTINCT FUNC("id"))');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -198,7 +198,7 @@ class DboSqliteTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '"int_field" integer NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'name',
|
||||
|
@ -208,7 +208,7 @@ class DboSqliteTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '"name" varchar(20) NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'testName',
|
||||
|
@ -220,7 +220,7 @@ class DboSqliteTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '"testName" varchar(20) DEFAULT NULL COLLATE NOCASE';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'testName',
|
||||
|
@ -231,7 +231,7 @@ class DboSqliteTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '"testName" varchar(20) DEFAULT \'test-value\' NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'testName',
|
||||
|
@ -242,8 +242,8 @@ class DboSqliteTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '"testName" integer(10) DEFAULT 10 NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'name' => 'testName',
|
||||
'type' => 'integer',
|
||||
|
@ -254,7 +254,7 @@ class DboSqliteTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Dbo->buildColumn($data);
|
||||
$expected = '"testName" integer(10) DEFAULT 10 NOT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -299,7 +299,7 @@ class DboSqliteTest extends CakeTestCase {
|
|||
'length' => null,
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ App::uses('DboSource', 'Model/Datasource');
|
|||
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
|
||||
|
||||
class MockDataSource extends DataSource {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,7 +155,7 @@ class DboSourceTest extends CakeTestCase {
|
|||
$expression = $this->testDb->expression("CASE Sample.id WHEN 1 THEN 'Id One' ELSE 'Other Id' END AS case_col");
|
||||
$result = $this->testDb->order($expression);
|
||||
$expected = " ORDER BY CASE Sample.id WHEN 1 THEN 'Id One' ELSE 'Other Id' END AS case_col";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -445,14 +445,14 @@ class DboSourceTest extends CakeTestCase {
|
|||
'conditions' => array('TestModel.field_name' => 'value'),
|
||||
'fields' => null, 'order' => null, 'recursive' => null
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->query('findByFindBy', array('value'), $this->Model);
|
||||
$expected = array('first', array(
|
||||
'conditions' => array('TestModel.find_by' => 'value'),
|
||||
'fields' => null, 'order' => null, 'recursive' => null
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->query('findAllByFieldName', array('value'), $this->Model);
|
||||
$expected = array('all', array(
|
||||
|
@ -460,7 +460,7 @@ class DboSourceTest extends CakeTestCase {
|
|||
'fields' => null, 'order' => null, 'limit' => null,
|
||||
'page' => null, 'recursive' => null
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->query('findAllById', array('a'), $this->Model);
|
||||
$expected = array('all', array(
|
||||
|
@ -468,32 +468,32 @@ class DboSourceTest extends CakeTestCase {
|
|||
'fields' => null, 'order' => null, 'limit' => null,
|
||||
'page' => null, 'recursive' => null
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->query('findByFieldName', array(array('value1', 'value2', 'value3')), $this->Model);
|
||||
$expected = array('first', array(
|
||||
'conditions' => array('TestModel.field_name' => array('value1', 'value2', 'value3')),
|
||||
'fields' => null, 'order' => null, 'recursive' => null
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->query('findByFieldName', array(null), $this->Model);
|
||||
$expected = array('first', array(
|
||||
'conditions' => array('TestModel.field_name' => null),
|
||||
'fields' => null, 'order' => null, 'recursive' => null
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->query('findByFieldName', array('= a'), $this->Model);
|
||||
$expected = array('first', array(
|
||||
'conditions' => array('TestModel.field_name' => '= a'),
|
||||
'fields' => null, 'order' => null, 'recursive' => null
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->query('findByFieldName', array(), $this->Model);
|
||||
$expected = false;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->query('directCall', array(), $this->Model);
|
||||
$this->assertFalse($result);
|
||||
|
@ -518,7 +518,7 @@ class DboSourceTest extends CakeTestCase {
|
|||
|
||||
$result = $this->testDb->value(array('first', 2, 'third'));
|
||||
$expected = array('\'first\'', 2, '\'third\'');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -542,55 +542,55 @@ class DboSourceTest extends CakeTestCase {
|
|||
function testName() {
|
||||
$result = $this->testDb->name('name');
|
||||
$expected = '`name`';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name(array('name', 'Model.*'));
|
||||
$expected = array('`name`', '`Model`.*');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name('MTD()');
|
||||
$expected = 'MTD()';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name('(sm)');
|
||||
$expected = '(sm)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name('name AS x');
|
||||
$expected = '`name` AS `x`';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name('Model.name AS x');
|
||||
$expected = '`Model`.`name` AS `x`';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name('Function(Something.foo)');
|
||||
$expected = 'Function(`Something`.`foo`)';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name('Function(SubFunction(Something.foo))');
|
||||
$expected = 'Function(SubFunction(`Something`.`foo`))';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name('Function(Something.foo) AS x');
|
||||
$expected = 'Function(`Something`.`foo`) AS `x`';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name('name-with-minus');
|
||||
$expected = '`name-with-minus`';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name(array('my-name', 'Foo-Model.*'));
|
||||
$expected = array('`my-name`', '`Foo-Model`.*');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name(array('Team.P%', 'Team.G/G'));
|
||||
$expected = array('`Team`.`P%`', '`Team`.`G/G`');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->testDb->name('Model.name as y');
|
||||
$expected = '`Model`.`name` AS `y`';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -633,7 +633,7 @@ class DboSourceTest extends CakeTestCase {
|
|||
$log = $this->testDb->getLog(false, false);
|
||||
$result = Set::extract($log['log'], '/query');
|
||||
$expected = array('Query 1', 'Query 2');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$oldError = $this->testDb->error;
|
||||
$this->testDb->error = true;
|
||||
|
@ -644,7 +644,7 @@ class DboSourceTest extends CakeTestCase {
|
|||
$log = $this->testDb->getLog(false, false);
|
||||
$result = Set::combine($log['log'], '/query', '/error');
|
||||
$expected = array('Query 1' => false, 'Query 2' => false, 'Error 1' => true);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
Configure::write('debug', 2);
|
||||
ob_start();
|
||||
|
@ -775,7 +775,7 @@ class DboSourceTest extends CakeTestCase {
|
|||
$Article->tablePrefix = 'tbl_';
|
||||
$result = $this->testDb->fullTableName($Article, false);
|
||||
$this->assertEqual($result, 'tbl_articles');
|
||||
|
||||
|
||||
$Article->useTable = $Article->table = 'with spaces';
|
||||
$Article->tablePrefix = '';
|
||||
$result = $this->testDb->fullTableName($Article);
|
||||
|
|
|
@ -276,27 +276,27 @@ class AclNodeTest extends CakeTestCase {
|
|||
$Aco = new DbAcoTest();
|
||||
$result = Set::extract($Aco->node('Controller1'), '{n}.DbAcoTest.id');
|
||||
$expected = array(2, 1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::extract($Aco->node('Controller1/action1'), '{n}.DbAcoTest.id');
|
||||
$expected = array(3, 2, 1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::extract($Aco->node('Controller2/action1'), '{n}.DbAcoTest.id');
|
||||
$expected = array(7, 6, 1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::extract($Aco->node('Controller1/action2'), '{n}.DbAcoTest.id');
|
||||
$expected = array(5, 2, 1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::extract($Aco->node('Controller1/action1/record1'), '{n}.DbAcoTest.id');
|
||||
$expected = array(4, 3, 2, 1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::extract($Aco->node('Controller2/action1/record1'), '{n}.DbAcoTest.id');
|
||||
$expected = array(8, 7, 6, 1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::extract($Aco->node('Controller2/action3'), '{n}.DbAcoTest.id');
|
||||
$this->assertFalse($result);
|
||||
|
@ -330,12 +330,12 @@ class AclNodeTest extends CakeTestCase {
|
|||
Configure::write('DbAclbindMode', 'string');
|
||||
$result = Set::extract($Aro->node(array('DbAroUserTest' => array('id' => '1', 'foreign_key' => '1'))), '{n}.DbAroTest.id');
|
||||
$expected = array(3, 2, 1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
Configure::write('DbAclbindMode', 'array');
|
||||
$result = Set::extract($Aro->node(array('DbAroUserTest' => array('id' => 4, 'foreign_key' => 2))), '{n}.DbAroTest.id');
|
||||
$expected = array(4);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* testNodeObjectFind method
|
||||
|
@ -349,12 +349,12 @@ class AclNodeTest extends CakeTestCase {
|
|||
$Model->id = 1;
|
||||
$result = Set::extract($Aro->node($Model), '{n}.DbAroTest.id');
|
||||
$expected = array(3, 2, 1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$Model->id = 2;
|
||||
$result = Set::extract($Aro->node($Model), '{n}.DbAroTest.id');
|
||||
$expected = array(4, 2, 1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
|
@ -380,6 +380,6 @@ class AclNodeTest extends CakeTestCase {
|
|||
array('DbAcoTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'Application', 'lft' => '1', 'rght' => '4'), 'DbAroTest' => array()),
|
||||
array('DbAcoTest' => array('id' => '2', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'Pages', 'lft' => '2', 'rght' => '3', ), 'DbAroTest' => array())
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
'item_id' => 5,
|
||||
'portfolio_id' => 1
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$Portfolio->delete(1);
|
||||
|
||||
|
@ -133,7 +133,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
array('ArticlesTag' => array('article_id' => '2', 'tag_id' => '1')),
|
||||
array('ArticlesTag' => array('article_id' => '2', 'tag_id' => '3'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->delete(1);
|
||||
$result = $TestModel->ArticlesTag->find('all');
|
||||
|
@ -142,7 +142,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
array('ArticlesTag' => array('article_id' => '2', 'tag_id' => '1')),
|
||||
array('ArticlesTag' => array('article_id' => '2', 'tag_id' => '3'))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,7 +172,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
)));
|
||||
|
||||
$this->assertTrue(is_array($result));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$Book->delete(1);
|
||||
|
||||
|
@ -182,7 +182,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
$expected = array();
|
||||
|
||||
$this->assertTrue(is_array($result));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,7 +214,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
'id' => 3,
|
||||
'title' => 'Third Article'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->delete(3);
|
||||
$this->assertTrue($result);
|
||||
|
@ -232,7 +232,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
'title' => 'First Article'
|
||||
)));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
// make sure deleting a non-existent record doesn't break save()
|
||||
// ticket #6293
|
||||
|
@ -261,10 +261,10 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
'id' => '8208C7FE-E89C-47C5-B378-DED6C271F9B8')),
|
||||
array('Uuid' => array(
|
||||
'id' => 'B607DAB9-88A2-46CF-B57C-842CA9E3B3B3')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* test that delete() updates the correct records counterCache() records.
|
||||
*
|
||||
|
@ -361,7 +361,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
'published' => 'N'
|
||||
)));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->deleteAll(array('Article.published' => 'N'));
|
||||
$this->assertTrue($result);
|
||||
|
@ -395,7 +395,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
'title' => 'Fifth Article',
|
||||
'published' => 'Y'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array('Article.user_id' => array(2, 3));
|
||||
$result = $TestModel->deleteAll($data, true, true);
|
||||
|
@ -418,7 +418,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
'title' => 'Third Article',
|
||||
'published' => 'Y'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->deleteAll(array('Article.user_id' => 999));
|
||||
$this->assertTrue($result, 'deleteAll returned false when all no records matched conditions. %s');
|
||||
|
@ -513,7 +513,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
'article_id' => '2',
|
||||
'tag_id' => '3'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->delete(1);
|
||||
$result = $TestModel->ArticlesTag->find('all');
|
||||
|
@ -527,7 +527,7 @@ class ModelDeleteTest extends BaseModelTest {
|
|||
'article_id' => '2',
|
||||
'tag_id' => '3'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->deleteAll(array('Article.user_id' => 999));
|
||||
$this->assertTrue($result, 'deleteAll returned false when all no records matched conditions. %s');
|
||||
|
|
|
@ -411,7 +411,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
|
||||
$TestModel->recursive = 0;
|
||||
$result = $TestModel->find('all');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
foreach ($expected as $key => $value) {
|
||||
unset($value['Comment'], $value['Tag']);
|
||||
|
@ -420,7 +420,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
|
||||
$TestModel->recursive = 0;
|
||||
$result = $TestModel->find('all');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::extract($TestModel->User->find('all'), '{n}.User.id');
|
||||
$this->assertEqual($result, array('1', '2', '3', '4'));
|
||||
|
@ -1141,7 +1141,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'TestPluginComment' => array()
|
||||
));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1185,7 +1185,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'counterQuery' => '',
|
||||
'association' => 'hasMany',
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1210,7 +1210,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '',
|
||||
'finderQuery' => '', 'deleteQuery' => '', 'insertQuery' => ''
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel = new ArticleFeatured();
|
||||
$TestFakeModel = new ArticleFeatured(array('table' => false));
|
||||
|
@ -1375,17 +1375,17 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
$TestModel = new Test();
|
||||
$result = $TestModel->alias;
|
||||
$expected = 'Test';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel = new TestAlias();
|
||||
$result = $TestModel->alias;
|
||||
$expected = 'TestAlias';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel = new Test(array('alias' => 'AnotherTest'));
|
||||
$result = $TestModel->alias;
|
||||
$expected = 'AnotherTest';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1475,7 +1475,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 10:41:23',
|
||||
'updated' => '2007-03-18 10:43:31'
|
||||
)))));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all');
|
||||
$expected = array(
|
||||
|
@ -1545,7 +1545,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'something_id' => '3',
|
||||
'something_else_id' => '1'
|
||||
)))));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->findById(1);
|
||||
$expected = array(
|
||||
|
@ -1570,13 +1570,13 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'something_id' => '1',
|
||||
'something_else_id' => '2'
|
||||
))));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$expected = $TestModel->findById(1);
|
||||
$TestModel->set($expected);
|
||||
$TestModel->save();
|
||||
$result = $TestModel->findById(1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->hasAndBelongsToMany['SomethingElse']['unique'] = false;
|
||||
$TestModel->create(array(
|
||||
|
@ -1637,7 +1637,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'something_else_id' => '3'
|
||||
))));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1694,7 +1694,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'father_id' => 0
|
||||
)));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->recursive = 3;
|
||||
$result = $TestModel->read(null, 1);
|
||||
|
@ -1747,7 +1747,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'Father' => array()
|
||||
)));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1855,7 +1855,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'updated' => '2007-03-18 10:57:31'
|
||||
))));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1869,7 +1869,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
$TestModel = new Test();
|
||||
$result = $TestModel->create();
|
||||
$expected = array('Test' => array('notes' => 'write some notes here'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$TestModel = new User();
|
||||
$result = $TestModel->schema();
|
||||
|
||||
|
@ -1919,12 +1919,12 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'length' => null
|
||||
));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel = new Article();
|
||||
$result = $TestModel->create();
|
||||
$expected = array('Article' => array('published' => 'N'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$FeaturedModel = new Featured();
|
||||
$data = array(
|
||||
|
@ -1990,15 +1990,15 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
|
||||
$result = $TestModel->escapeField('test_field');
|
||||
$expected = $db->name('Test.test_field');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->escapeField('TestField');
|
||||
$expected = $db->name('Test.TestField');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->escapeField('DomainHandle', 'Domain');
|
||||
$expected = $db->name('Domain.DomainHandle');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
ConnectionManager::create('mock', array('datasource' => 'DboMock'));
|
||||
$TestModel->setDataSource('mock');
|
||||
|
@ -2006,7 +2006,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
|
||||
$result = $TestModel->escapeField('DomainHandle', 'Domain');
|
||||
$expected = $db->name('Domain.DomainHandle');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -79,7 +79,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
*/
|
||||
function testGroupBy() {
|
||||
$db = ConnectionManager::getDataSource('test');
|
||||
$isStrictGroupBy = $this->db instanceof Postgres || $this->db instanceof Sqlite || $this->db instanceof Oracle;
|
||||
$isStrictGroupBy = $this->db instanceof Postgres || $this->db instanceof Sqlite || $this->db instanceof Oracle;
|
||||
$message = 'Postgres and Oracle have strict GROUP BY and are incompatible with this test.';
|
||||
|
||||
if ($this->skipIf($isStrictGroupBy, $message )) {
|
||||
|
@ -128,7 +128,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'thread_id' => 3,
|
||||
'name' => 'Thread 3, Message 1'
|
||||
))));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$rows = $Thread->find('all', array(
|
||||
'group' => 'Thread.project_id',
|
||||
|
@ -142,7 +142,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
1 => 2,
|
||||
2 => 1
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$rows = $Thread->find('all', array(
|
||||
'group' => 'Thread.project_id',
|
||||
|
@ -157,7 +157,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
1 => 2,
|
||||
2 => 1
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Thread->find('all', array(
|
||||
'conditions' => array('Thread.project_id' => 1),
|
||||
|
@ -180,37 +180,37 @@ class ModelReadTest extends BaseModelTest {
|
|||
'thread_id' => 1,
|
||||
'name' => 'Thread 1, Message 1'
|
||||
))));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Thread->find('all', array(
|
||||
'conditions' => array('Thread.project_id' => 1),
|
||||
'group' => 'Thread.project_id, Project.id'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Thread->find('all', array(
|
||||
'conditions' => array('Thread.project_id' => 1),
|
||||
'group' => 'project_id'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Thread->find('all', array(
|
||||
'conditions' => array('Thread.project_id' => 1),
|
||||
'group' => array('project_id')
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Thread->find('all', array(
|
||||
'conditions' => array('Thread.project_id' => 1),
|
||||
'group' => array('project_id', 'Project.id')
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Thread->find('all', array(
|
||||
'conditions' => array('Thread.project_id' => 1),
|
||||
'group' => array('Thread.project_id', 'Project.id')
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$expected = array(
|
||||
array('Product' => array('type' => 'Clothing'), array('price' => 32)),
|
||||
|
@ -223,13 +223,13 @@ class ModelReadTest extends BaseModelTest {
|
|||
'group'=> 'Product.type',
|
||||
'order' => 'Product.type ASC'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Product->find('all', array(
|
||||
'fields'=>array('Product.type', 'MIN(Product.price) as price'),
|
||||
'group'=> array('Product.type'),
|
||||
'order' => 'Product.type ASC'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,7 +297,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
unset($expected[0][$this->db->fullTableName('articles', false)]);
|
||||
}
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$result = $this->db->getQueryCache($query, $params);
|
||||
$this->assertFalse(empty($result));
|
||||
|
||||
|
@ -1083,7 +1083,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'name' => ''
|
||||
),
|
||||
'Child' => array()));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->Parent->unbindModel(array('hasOne' => array('Sample')));
|
||||
$this->assertTrue($result);
|
||||
|
@ -1749,7 +1749,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'Child' => array()
|
||||
));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->Parent->unbindModel(array('hasOne' => array('Sample')));
|
||||
$this->assertTrue($result);
|
||||
|
@ -2178,7 +2178,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'name' => ''
|
||||
)));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->unbindModel(array('hasMany' => array('Child')));
|
||||
$this->assertTrue($result);
|
||||
|
@ -2597,7 +2597,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'apple_id' => '',
|
||||
'name' => ''
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->Parent->unbindModel(array('belongsTo' => array('Parent')));
|
||||
$this->assertTrue($result);
|
||||
|
@ -2982,7 +2982,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'apple_id' => '',
|
||||
'name' => ''
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3102,7 +3102,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('threaded', array(
|
||||
'conditions' => array('Category.name LIKE' => 'Category 1%')
|
||||
|
@ -3155,7 +3155,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('threaded', array(
|
||||
'fields' => 'id, parent_id, name'
|
||||
|
@ -3223,7 +3223,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('threaded', array('order' => 'id DESC'));
|
||||
|
||||
|
@ -3305,7 +3305,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('threaded', array(
|
||||
'conditions' => array('Category.name LIKE' => 'Category 3%')
|
||||
|
@ -3333,7 +3333,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('threaded', array(
|
||||
'conditions' => array('Category.name LIKE' => 'Category 1.1%')
|
||||
|
@ -3361,7 +3361,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 15:30:23',
|
||||
'updated' => '2007-03-18 15:32:31'),
|
||||
'children' => array()))));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('threaded', array(
|
||||
'fields' => 'id, parent_id, name',
|
||||
|
@ -3411,7 +3411,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array(
|
||||
'fields' => 'id, name, parent_id',
|
||||
|
@ -3453,7 +3453,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'name' => 'Category 1.1.2',
|
||||
'parent_id' => '2'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('threaded', array(
|
||||
'fields' => 'id, parent_id, name',
|
||||
|
@ -3487,7 +3487,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'children' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3522,7 +3522,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'Article' => array(
|
||||
'id' => 3
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->id = 3;
|
||||
$TestModel->recursive = 1;
|
||||
|
@ -3549,7 +3549,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->id = 2;
|
||||
$result = $TestModel->find('neighbors', array('recursive' => -1));
|
||||
|
@ -3577,7 +3577,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->id = 3;
|
||||
$result = $TestModel->find('neighbors', array('recursive' => -1));
|
||||
|
@ -3595,7 +3595,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
),
|
||||
'next' => null
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->recursive = 0;
|
||||
$TestModel->id = 1;
|
||||
|
@ -3608,17 +3608,17 @@ class ModelReadTest extends BaseModelTest {
|
|||
$TestModel->id = 1;
|
||||
$result = $TestModel->find('neighbors');
|
||||
$expected = array('prev' => null, 'next' => $two);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->id = 2;
|
||||
$result = $TestModel->find('neighbors');
|
||||
$expected = array('prev' => $one, 'next' => $three);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->id = 3;
|
||||
$result = $TestModel->find('neighbors');
|
||||
$expected = array('prev' => $two, 'next' => null);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->recursive = 2;
|
||||
$TestModel->id = 1;
|
||||
|
@ -3631,17 +3631,17 @@ class ModelReadTest extends BaseModelTest {
|
|||
$TestModel->id = 1;
|
||||
$result = $TestModel->find('neighbors', array('recursive' => 2));
|
||||
$expected = array('prev' => null, 'next' => $two);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->id = 2;
|
||||
$result = $TestModel->find('neighbors', array('recursive' => 2));
|
||||
$expected = array('prev' => $one, 'next' => $three);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->id = 3;
|
||||
$result = $TestModel->find('neighbors', array('recursive' => 2));
|
||||
$expected = array('prev' => $two, 'next' => null);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3918,7 +3918,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
),
|
||||
'Child' => array()
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3977,7 +3977,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4017,7 +4017,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
$recursive = -1;
|
||||
$order = 'Article.id ASC';
|
||||
$result = $TestModel->find('all', compact('conditions', 'recursive', 'order'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
if ($this->skipIf($this->db instanceof Postgres, 'The rest of testFindAllWithConditionsHavingMixedDataTypes test is not compatible with Postgres')) {
|
||||
return;
|
||||
|
@ -4060,7 +4060,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4085,7 +4085,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
|
||||
$result = $TestModel->hasMany;
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->bindModel(array('hasMany' => array('Comment')));
|
||||
$this->assertTrue($result);
|
||||
|
@ -4174,7 +4174,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'updated' => '2007-03-18 10:49:31'
|
||||
))));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->resetAssociations();
|
||||
$result = $TestModel->hasMany;
|
||||
|
@ -4268,7 +4268,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'updated' => '2007-03-18 10:49:31'
|
||||
))));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->hasMany;
|
||||
$expected = array(
|
||||
|
@ -4285,14 +4285,14 @@ class ModelReadTest extends BaseModelTest {
|
|||
'finderQuery' => null,
|
||||
'counterQuery' => null
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->unbindModel(array('hasMany' => array('Comment')));
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = $TestModel->hasMany;
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array(
|
||||
'fields' => 'User.id, User.user'
|
||||
|
@ -4302,7 +4302,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
array('User' => array('id' => '2', 'user' => 'nate')),
|
||||
array('User' => array('id' => '3', 'user' => 'larry')),
|
||||
array('User' => array('id' => '4', 'user' => 'garrett')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array(
|
||||
'fields' => 'User.id, User.user'
|
||||
|
@ -4388,7 +4388,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 10:47:23',
|
||||
'updated' => '2007-03-18 10:49:31'
|
||||
))));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->unbindModel(array('hasMany' => array('Comment')), false);
|
||||
$this->assertTrue($result);
|
||||
|
@ -4399,11 +4399,11 @@ class ModelReadTest extends BaseModelTest {
|
|||
array('User' => array('id' => '2', 'user' => 'nate')),
|
||||
array('User' => array('id' => '3', 'user' => 'larry')),
|
||||
array('User' => array('id' => '4', 'user' => 'garrett')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->hasMany;
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->bindModel(array('hasMany' => array(
|
||||
'Comment' => array('className' => 'Comment', 'conditions' => 'Comment.published = \'Y\'')
|
||||
|
@ -4483,7 +4483,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'updated' => '2007-03-18 10:49:31'
|
||||
))));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel2 = new DeviceType();
|
||||
|
||||
|
@ -4559,7 +4559,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
|
||||
$result = $TestModel->hasMany;
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->bindModel(array(
|
||||
'hasMany' => array(
|
||||
|
@ -4651,7 +4651,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 10:47:23',
|
||||
'updated' => '2007-03-18 10:49:31'
|
||||
))));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->bindModel(array(
|
||||
'hasMany' => array(
|
||||
|
@ -4717,7 +4717,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'Items' => array()
|
||||
));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4748,7 +4748,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
|
||||
$result = $TestModel->hasMany;
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->bindModel(array(
|
||||
'hasMany' => array('Comment')
|
||||
|
@ -4762,13 +4762,13 @@ class ModelReadTest extends BaseModelTest {
|
|||
|
||||
$result = array_keys($TestModel->hasMany);
|
||||
$expected = array('Comment', 'Article');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->resetAssociations();
|
||||
|
||||
$result = array_keys($TestModel->hasMany);
|
||||
$expected = array('Article');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4819,7 +4819,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
|
||||
$result = array_keys($TestModel->belongsTo);
|
||||
$expected = array('Article', 'User');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->unbindModel(array(
|
||||
'belongsTo' => array('User')
|
||||
|
@ -4833,13 +4833,13 @@ class ModelReadTest extends BaseModelTest {
|
|||
|
||||
$result = array_keys($TestModel->belongsTo);
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->resetAssociations();
|
||||
|
||||
$result = array_keys($TestModel->belongsTo);
|
||||
$expected = array('User');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4907,7 +4907,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'updated' => '2007-03-17 01:18:31',
|
||||
'test' => 'working'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
unset($TestModel);
|
||||
|
||||
$Author = new Author();
|
||||
|
@ -4947,19 +4947,19 @@ class ModelReadTest extends BaseModelTest {
|
|||
|
||||
$result = Set::extract($TestModel->find('all'), '/Author/user');
|
||||
$expected = array('mariano (CakePHP)', 'nate (CakePHP)', 'larry (CakePHP)', 'garrett (CakePHP)');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::extract($TestModel->find('all', array('callbacks' => 'after')), '/Author/user');
|
||||
$expected = array('mariano (CakePHP)', 'nate (CakePHP)', 'larry (CakePHP)', 'garrett (CakePHP)');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::extract($TestModel->find('all', array('callbacks' => 'before')), '/Author/user');
|
||||
$expected = array('mariano', 'nate', 'larry', 'garrett');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::extract($TestModel->find('all', array('callbacks' => false)), '/Author/user');
|
||||
$expected = array('mariano', 'nate', 'larry', 'garrett');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5133,7 +5133,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'Image' => array()
|
||||
))));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5234,7 +5234,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
),
|
||||
'Tag' => array()
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5348,13 +5348,13 @@ class ModelReadTest extends BaseModelTest {
|
|||
'updated' => '2007-03-18 12:28:31'
|
||||
)));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->hasAndBelongsToMany['Tag']['limit'] = 1;
|
||||
$result = $TestModel->read(null, 2);
|
||||
unset($expected['Tag'][1]);
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5469,7 +5469,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'Thread' => array()
|
||||
));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5576,7 +5576,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'updated' => '2007-03-18 10:43:31'
|
||||
)))));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5644,7 +5644,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'name' => 'computer'
|
||||
))))));
|
||||
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5709,7 +5709,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)))))));
|
||||
|
||||
$this->db->fullDebug = $fullDebug;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5774,7 +5774,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)))))));
|
||||
|
||||
$this->db->fullDebug = $fullDebug;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5995,7 +5995,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
))))))));
|
||||
|
||||
$this->db->fullDebug = $fullDebug;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6061,7 +6061,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:22:23',
|
||||
'updated' => '2007-03-17 01:24:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('conditions' => 'User.id > 2'));
|
||||
$expected = array(
|
||||
|
@ -6081,7 +6081,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:22:23',
|
||||
'updated' => '2007-03-17 01:24:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array(
|
||||
'conditions' => array('User.id !=' => '0', 'User.user LIKE' => '%arr%')
|
||||
|
@ -6103,11 +6103,11 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:22:23',
|
||||
'updated' => '2007-03-17 01:24:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('conditions' => array('User.id' => '0')));
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array(
|
||||
'conditions' => array('or' => array('User.id' => '0', 'User.user LIKE' => '%a%')
|
||||
|
@ -6146,7 +6146,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:22:23',
|
||||
'updated' => '2007-03-17 01:24:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('fields' => 'User.id, User.user'));
|
||||
$expected = array(
|
||||
|
@ -6154,7 +6154,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
array('User' => array('id' => '2', 'user' => 'nate')),
|
||||
array('User' => array('id' => '3', 'user' => 'larry')),
|
||||
array('User' => array('id' => '4', 'user' => 'garrett')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('fields' => 'User.user', 'order' => 'User.user ASC'));
|
||||
$expected = array(
|
||||
|
@ -6162,7 +6162,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
array('User' => array('user' => 'larry')),
|
||||
array('User' => array('user' => 'mariano')),
|
||||
array('User' => array('user' => 'nate')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('fields' => 'User.user', 'order' => 'User.user DESC'));
|
||||
$expected = array(
|
||||
|
@ -6170,7 +6170,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
array('User' => array('user' => 'mariano')),
|
||||
array('User' => array('user' => 'larry')),
|
||||
array('User' => array('user' => 'garrett')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('limit' => 3, 'page' => 1));
|
||||
|
||||
|
@ -6199,7 +6199,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:20:23',
|
||||
'updated' => '2007-03-17 01:22:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$ids = array(4 => 1, 5 => 3);
|
||||
$result = $TestModel->find('all', array(
|
||||
|
@ -6223,7 +6223,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:20:23',
|
||||
'updated' => '2007-03-17 01:22:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
// These tests are expected to fail on SQL Server since the LIMIT/OFFSET
|
||||
// hack can't handle small record counts.
|
||||
|
@ -6238,11 +6238,11 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:22:23',
|
||||
'updated' => '2007-03-17 01:24:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array('limit' => 3, 'page' => 3));
|
||||
$expected = array();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6267,7 +6267,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
2 => 'Second Article',
|
||||
3 => 'Third Article'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$db = ConnectionManager::getDataSource('test');
|
||||
if ($db instanceof Mysql) {
|
||||
|
@ -6279,7 +6279,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
3 => 'Third Article',
|
||||
2 => 'Second Article'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
$result = Set::combine(
|
||||
|
@ -6294,7 +6294,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
2 => 'Second Article',
|
||||
3 => 'Third Article'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::combine(
|
||||
$TestModel->find('all', array(
|
||||
|
@ -6331,7 +6331,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'updated' => '2007-03-18 10:45:31'
|
||||
));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::combine(
|
||||
$TestModel->find('all', array(
|
||||
|
@ -6370,7 +6370,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'updated' => '2007-03-18 10:43:31'
|
||||
)));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::combine(
|
||||
$TestModel->find('all', array(
|
||||
|
@ -6388,7 +6388,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
3 => array(
|
||||
2 => 'Second Article'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel = new Apple();
|
||||
$expected = array(
|
||||
|
@ -6413,7 +6413,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
2 => 'Second Post',
|
||||
3 => 'Third Post'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('list', array(
|
||||
'fields' => 'title'
|
||||
|
@ -6423,7 +6423,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
2 => 'Second Post',
|
||||
3 => 'Third Post'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('list', array(
|
||||
'fields' => array('title', 'id')
|
||||
|
@ -6433,7 +6433,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'Second Post' => '2',
|
||||
'Third Post' => '3'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('list', array(
|
||||
'fields' => array('title', 'id', 'created')
|
||||
|
@ -6449,7 +6449,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'Third Post' => '3'
|
||||
),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('list', array(
|
||||
'fields' => array('Post.body')
|
||||
|
@ -6459,7 +6459,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
2 => 'Second Post Body',
|
||||
3 => 'Third Post Body'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('list', array(
|
||||
'fields' => array('Post.title', 'Post.body')
|
||||
|
@ -6469,7 +6469,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'Second Post' => 'Second Post Body',
|
||||
'Third Post' => 'Third Post Body'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('list', array(
|
||||
'fields' => array('Post.id', 'Post.title', 'Author.user'),
|
||||
|
@ -6483,7 +6483,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'larry' => array(
|
||||
2 => 'Second Post'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel = new User();
|
||||
$result = $TestModel->find('list', array(
|
||||
|
@ -6495,7 +6495,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'larry' => '5f4dcc3b5aa765d61d8327deb882cf99',
|
||||
'garrett' => '5f4dcc3b5aa765d61d8327deb882cf99'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel = new ModifiedAuthor();
|
||||
$result = $TestModel->find('list', array(
|
||||
|
@ -6507,7 +6507,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
3 => 'larry (CakePHP)',
|
||||
4 => 'garrett (CakePHP)'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel = new Article();
|
||||
$TestModel->displayField = 'title';
|
||||
|
@ -6519,7 +6519,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
1 => 'First Article',
|
||||
3 => 'Third Article'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6682,7 +6682,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:16:23',
|
||||
'updated' => '2007-03-17 01:18:31'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->findByPassword('5f4dcc3b5aa765d61d8327deb882cf99');
|
||||
$expected = array('User' => array(
|
||||
|
@ -6692,7 +6692,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:16:23',
|
||||
'updated' => '2007-03-17 01:18:31'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6718,7 +6718,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:18:23',
|
||||
'updated' => '2007-03-17 01:20:31'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->read(null, 2);
|
||||
$expected = array(
|
||||
|
@ -6729,12 +6729,12 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-17 01:18:23',
|
||||
'updated' => '2007-03-17 01:20:31'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->id = 2;
|
||||
$result = $TestModel->read(array('id', 'user'));
|
||||
$expected = array('User' => array('id' => '2', 'user' => 'nate'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->read('id, user', 2);
|
||||
$expected = array(
|
||||
|
@ -6742,7 +6742,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'id' => '2',
|
||||
'user' => 'nate'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->bindModel(array('hasMany' => array('Article')));
|
||||
$this->assertTrue($result);
|
||||
|
@ -6773,7 +6773,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 10:43:23',
|
||||
'updated' => '2007-03-18 10:45:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6802,7 +6802,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
$expected = array(
|
||||
'User' => array('id' => '1', 'user' => 'mariano'),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->recursive = 1;
|
||||
$result = $TestModel->read('id, user', 1);
|
||||
|
@ -6830,7 +6830,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 10:43:23',
|
||||
'updated' => '2007-03-18 10:45:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->recursive = 2;
|
||||
$result = $TestModel->read('id, user', 3);
|
||||
|
@ -6887,7 +6887,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 12:26:23',
|
||||
'updated' => '2007-03-18 12:28:31'
|
||||
)))));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
function testRecursiveFindAll() {
|
||||
|
@ -6996,7 +6996,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'Tag' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->find('all', array(
|
||||
'conditions' => array('Article.user_id' => 3),
|
||||
|
@ -7096,7 +7096,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'updated' => '2007-03-18 12:28:31'
|
||||
))));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$Featured = new Featured();
|
||||
|
||||
|
@ -7199,7 +7199,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 15:30:23',
|
||||
'updated' => '2007-03-18 15:32:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7289,7 +7289,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
'Tag' => array()
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->hasMany['Comment']['limit'] = 1;
|
||||
|
||||
|
@ -7366,7 +7366,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* Testing availability of $this->findQueryType in Model callbacks
|
||||
|
|
|
@ -520,7 +520,7 @@ class ModelValidationTest extends BaseModelTest {
|
|||
$expected = array(
|
||||
'title' => array('tooShort')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->validate = array(
|
||||
'title' => array(
|
||||
|
@ -541,7 +541,7 @@ class ModelValidationTest extends BaseModelTest {
|
|||
$expected = array(
|
||||
'title' => array('tooShort', 'onlyLetters')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => '2008-01-03 10:56:33',
|
||||
'updated' => '2008-01-03 10:56:33'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->JoinAsJoinB->create();
|
||||
$data = array(
|
||||
|
@ -69,7 +69,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => '2008-01-03 10:56:33',
|
||||
'updated' => '2008-01-03 10:56:33'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$updatedValue = 'UPDATED Data for Join A 1 Join B 2';
|
||||
$TestModel->JoinAsJoinB->id = 1;
|
||||
|
@ -324,7 +324,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
|
||||
$result = $user[$User->alias]['post_count'];
|
||||
$expected = 3;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -346,7 +346,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
|
||||
$result = $user[$User->alias]['post_count'];
|
||||
$expected = 1;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -425,7 +425,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$Category->updateCounterCache(array('parent_id' => 5));
|
||||
$result = Set::extract($Category->find('all', array('conditions' => array('CategoryThread.id' => 5))), '{n}.CategoryThread.child_count');
|
||||
$expected = array_fill(0, 1, 1);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -528,7 +528,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'New First Article',
|
||||
'body' => 'First Article Body'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->id = 1;
|
||||
$result = $TestModel->saveField('title', '');
|
||||
|
@ -543,7 +543,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'First Article Body'
|
||||
));
|
||||
$result['Article']['title'] = trim($result['Article']['title']);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->id = 1;
|
||||
$TestModel->set('body', 'Messed up data');
|
||||
|
@ -556,7 +556,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'First Article',
|
||||
'body' => 'First Article Body'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->recursive = -1;
|
||||
$result = $TestModel->read(array('id', 'user_id', 'title', 'body'), 1);
|
||||
|
@ -638,7 +638,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'First Article Body',
|
||||
'published' => 'N'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array('Article' => array(
|
||||
'id' => 1,
|
||||
|
@ -659,7 +659,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'First Article Body',
|
||||
'published' => 'Y'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'Article' => array(
|
||||
|
@ -708,7 +708,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 12:26:23',
|
||||
'updated' => '2007-03-18 12:28:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array('Comment' => array(
|
||||
'article_id' => '4',
|
||||
|
@ -795,7 +795,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'updated' => '2007-03-18 12:28:31'
|
||||
)));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -857,7 +857,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Fourth Article Body',
|
||||
'published' => 'Y'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
// Create new record just to overlap Model->id on previously created record
|
||||
|
||||
|
@ -879,7 +879,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Fifth Article Body',
|
||||
'published' => 'Y'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
// Go back and edit the first article we created, starting by checking it's still there
|
||||
|
||||
|
@ -892,7 +892,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Fourth Article Body',
|
||||
'published' => 'Y'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
// And now do the update with set()
|
||||
|
||||
|
@ -913,7 +913,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Fourth Article Body',
|
||||
'published' => 'N'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->recursive = -1;
|
||||
$result = $TestModel->read(array('id', 'user_id', 'title', 'body', 'published'), 5);
|
||||
|
@ -924,7 +924,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Fifth Article Body',
|
||||
'published' => 'Y'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array('Article' => array('id' => '5', 'title' => 'Fifth Article - New Title 5'));
|
||||
$result = ($TestModel->set($data) && $TestModel->save());
|
||||
|
@ -939,7 +939,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Fifth Article Body',
|
||||
'published' => 'Y'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->recursive = -1;
|
||||
$result = $TestModel->find('all', array('fields' => array('id', 'title')));
|
||||
|
@ -950,7 +950,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
array('Article' => array('id' => 4, 'title' => 'Fourth Article - New Title' )),
|
||||
array('Article' => array('id' => 5, 'title' => 'Fifth Article - New Title 5' ))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -982,7 +982,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'published' => 'N'
|
||||
));
|
||||
$result = $TestModel->read(array('id', 'user_id', 'title', 'body', 'published'), 4);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'user_id' => '1',
|
||||
|
@ -1002,7 +1002,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'published' => 'N'
|
||||
));
|
||||
$result = $TestModel->read(array('id', 'user_id', 'title', 'body', 'published'), 5);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1095,7 +1095,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'Article' => array(
|
||||
|
@ -1132,7 +1132,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 12:24:23',
|
||||
'updated' => '2007-03-18 12:26:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array('Article' => array('id' => '2'), 'Tag' => array('Tag' => array(2, 3)));
|
||||
$result = $TestModel->set($data);
|
||||
|
@ -1166,7 +1166,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 12:26:23',
|
||||
'updated' => '2007-03-18 12:28:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array('Tag' => array('Tag' => array(1, 2, 3)));
|
||||
|
||||
|
@ -1207,7 +1207,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 12:26:23',
|
||||
'updated' => '2007-03-18 12:28:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array('Tag' => array('Tag' => array()));
|
||||
$result = $TestModel->set($data);
|
||||
|
@ -1237,7 +1237,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
),
|
||||
'Tag' => array()
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array('Tag' => array('Tag' => array(2, 3)));
|
||||
$result = $TestModel->set($data);
|
||||
|
@ -1271,7 +1271,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 12:26:23',
|
||||
'updated' => '2007-03-18 12:28:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'Tag' => array(
|
||||
|
@ -1311,7 +1311,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 12:24:23',
|
||||
'updated' => '2007-03-18 12:26:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'Tag' => array(
|
||||
|
@ -1353,7 +1353,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'Tag' => array(
|
||||
|
@ -1395,7 +1395,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'Tag' => array(
|
||||
|
@ -1435,7 +1435,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 12:26:23',
|
||||
'updated' => '2007-03-18 12:28:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'Article' => array(
|
||||
|
@ -1484,7 +1484,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => '2007-03-18 12:26:23',
|
||||
'updated' => '2007-03-18 12:28:31'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
|
||||
$this->loadFixtures('JoinA', 'JoinC', 'JoinAC', 'JoinB', 'JoinAB');
|
||||
|
@ -1559,7 +1559,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
),
|
||||
'Tag' => array()
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1745,7 +1745,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Some text'
|
||||
));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertEqual($TestModel->id, 5);
|
||||
|
||||
$result = $TestModel->create($data, true);
|
||||
|
@ -1758,7 +1758,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Some text'
|
||||
));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertFalse($TestModel->id);
|
||||
|
||||
$result = $TestModel->create(array('Article' => $data), true);
|
||||
|
@ -1771,7 +1771,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Some text'
|
||||
));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertFalse($TestModel->id);
|
||||
|
||||
$data = array(
|
||||
|
@ -1796,7 +1796,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'updated' => '1970-01-01 12:00:00',
|
||||
'modified' => '1970-01-01 12:00:00'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertEqual($TestModel->id, 6);
|
||||
|
||||
$result = $TestModel->create(array(
|
||||
|
@ -1813,7 +1813,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'My article',
|
||||
'body' => 'Some text'
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertFalse($TestModel->id);
|
||||
}
|
||||
|
||||
|
@ -2195,12 +2195,12 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$TestModel = new Comment();
|
||||
$result = Set::extract($TestModel->find('all'), '{n}.Comment.user_id');
|
||||
$expected = array('2', '4', '1', '1', '1', '2');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->updateAll(array('Comment.user_id' => 5), array('Comment.user_id' => 2));
|
||||
$result = Set::combine($TestModel->find('all'), '{n}.Comment.id', '{n}.Comment.user_id');
|
||||
$expected = array(1 => 5, 2 => 4, 3 => 1, 4 => 1, 5 => 1, 6 => 5);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $TestModel->updateAll(
|
||||
array('Comment.comment' => "'Updated today'"),
|
||||
|
@ -2215,7 +2215,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'{n}.Comment.comment'
|
||||
);
|
||||
$expected = array_fill(0, 2, 'Updated today');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2355,7 +2355,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'updated' => '2008-01-03 10:57:22'
|
||||
))));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$ts = date('Y-m-d H:i:s');
|
||||
$TestModel->id = 1;
|
||||
|
@ -2423,7 +2423,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'updated' => $ts
|
||||
))));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2517,7 +2517,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => $ts,
|
||||
'updated' => $ts
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel = new Comment();
|
||||
$ts = date('Y-m-d H:i:s');
|
||||
|
@ -2679,7 +2679,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'comment_id' => '1',
|
||||
'attachment' => 'some_file.zip'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
|
||||
$model->Attachment->bindModel(array('belongsTo' => array('Comment')), false);
|
||||
|
@ -2732,7 +2732,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'id' => '1',
|
||||
'title' => 'Model Associations 101'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2953,7 +2953,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
)
|
||||
), array('validate' => true));
|
||||
$expected = array('Comment' => array(false));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$expected = array('Comment' => array(
|
||||
array('comment' => array('This field cannot be left blank'))
|
||||
|
@ -3142,12 +3142,12 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'updated' => $ts
|
||||
));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
// Skip the rest of the transactional tests
|
||||
return;
|
||||
}
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
array('author_id' => 1, 'title' => 'New Fourth Post'),
|
||||
|
@ -3211,7 +3211,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'updated' => $ts
|
||||
));
|
||||
}
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->validate = array('title' => 'notEmpty');
|
||||
$data = array(
|
||||
|
@ -3263,7 +3263,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => '',
|
||||
'published' => 'N'
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3337,7 +3337,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => $ts,
|
||||
'updated' => $ts
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$TestModel->validate = array('title' => 'notEmpty', 'author_id' => 'numeric');
|
||||
$data = array(
|
||||
|
@ -3424,7 +3424,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'created' => $ts,
|
||||
'updated' => $ts
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertEqual($TestModel->validationErrors, $errors);
|
||||
|
||||
$data = array(
|
||||
|
@ -3442,7 +3442,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$this->assertFalse($TestModel->saveAll($data, array('validate' => 'first')));
|
||||
|
||||
$result = $TestModel->find('all', array('recursive' => -1, 'order' => 'Post.id ASC'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertEqual($TestModel->validationErrors, $errors);
|
||||
|
||||
$data = array(
|
||||
|
@ -3628,7 +3628,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'validate' => 'first',
|
||||
));
|
||||
$expected = array(true, false);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$Something = new Something();
|
||||
$validData = array(
|
||||
|
@ -3649,7 +3649,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'validate' => 'first',
|
||||
));
|
||||
$expected = array(true, true);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3744,7 +3744,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'Article' => true,
|
||||
'Comment' => array(false, true, false)
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$expected = array('Comment' => array(
|
||||
0 => array('comment' => array('This field cannot be left blank')),
|
||||
|
|
|
@ -25,7 +25,7 @@ class CakeResponseTestCase extends CakeTestCase {
|
|||
$this->assertEquals($response->body(), 'This is the body');
|
||||
$this->assertEquals($response->charset(), 'my-custom-charset');
|
||||
$this->assertEquals($response->type(), 'audio/mpeg');
|
||||
$this->assertEquals($response->statusCode(), 203);
|
||||
$this->assertEquals($response->statusCode(), 203);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -300,7 +300,7 @@ class CakeResponseTestCase extends CakeTestCase {
|
|||
|
||||
$result = $response->httpCodes(100);
|
||||
$expected = array(100 => 'Continue');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$codes = array(
|
||||
1337 => 'Undefined Unicorn',
|
||||
|
@ -313,7 +313,7 @@ class CakeResponseTestCase extends CakeTestCase {
|
|||
|
||||
$result = $response->httpCodes(1337);
|
||||
$expected = array(1337 => 'Undefined Unicorn');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$codes = array(404 => 'Sorry Bro');
|
||||
$result = $response->httpCodes($codes);
|
||||
|
@ -322,7 +322,7 @@ class CakeResponseTestCase extends CakeTestCase {
|
|||
|
||||
$result = $response->httpCodes(404);
|
||||
$expected = array(404 => 'Sorry Bro');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -353,4 +353,4 @@ class CakeResponseTestCase extends CakeTestCase {
|
|||
$result = $response->mapType(array('application/json', 'application/xhtml+xml', 'text/css'));
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -278,19 +278,19 @@ class CakeEmailTest extends CakeTestCase {
|
|||
public function testFormatAddress() {
|
||||
$result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => 'cake@cakephp.org'));
|
||||
$expected = array('cake@cakephp.org');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => 'cake@cakephp.org', 'php@cakephp.org' => 'php@cakephp.org'));
|
||||
$expected = array('cake@cakephp.org', 'php@cakephp.org');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => 'CakePHP', 'php@cakephp.org' => 'Cake'));
|
||||
$expected = array('CakePHP <cake@cakephp.org>', 'Cake <php@cakephp.org>');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => 'ÄÖÜTest'));
|
||||
$expected = array('=?UTF-8?B?w4TDlsOcVGVzdA==?= <cake@cakephp.org>');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -771,7 +771,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
'non commodo odio. Morbi nibh nisi, vehicula pellentesque accumsan amet.',
|
||||
''
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$text = 'Lorem ipsum dolor sit amet, consectetur < adipiscing elit. Donec ac turpis orci, non commodo odio. Morbi nibh nisi, vehicula > pellentesque accumsan amet.';
|
||||
$result = $this->CakeEmail->wrap($text);
|
||||
|
@ -781,7 +781,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
'amet.',
|
||||
''
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$text = '<p>Lorem ipsum dolor sit amet,<br> consectetur adipiscing elit.<br> Donec ac turpis orci, non <b>commodo</b> odio. <br /> Morbi nibh nisi, vehicula pellentesque accumsan amet.<hr></p>';
|
||||
$result = $this->CakeEmail->wrap($text);
|
||||
|
@ -791,7 +791,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
'pellentesque accumsan amet.<hr></p>',
|
||||
''
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac <a href="http://cakephp.org">turpis</a> orci, non commodo odio. Morbi nibh nisi, vehicula pellentesque accumsan amet.';
|
||||
$result = $this->CakeEmail->wrap($text);
|
||||
|
@ -801,7 +801,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
'nisi, vehicula pellentesque accumsan amet.',
|
||||
''
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$text = 'Lorem ipsum <a href="http://www.cakephp.org/controller/action/param1/param2" class="nice cool fine amazing awesome">ok</a>';
|
||||
$result = $this->CakeEmail->wrap($text);
|
||||
|
@ -811,7 +811,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
'ok</a>',
|
||||
''
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$text = 'Lorem ipsum withonewordverybigMorethanthelineshouldsizeofrfcspecificationbyieeeavailableonieeesite ok.';
|
||||
$result = $this->CakeEmail->wrap($text);
|
||||
|
@ -821,7 +821,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
'ok.',
|
||||
''
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1263,7 +1263,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
$Dispatcher->asset('test_plugin/root.js');
|
||||
$result = ob_get_clean();
|
||||
$expected = file_get_contents(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'webroot' . DS . 'root.js');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
ob_start();
|
||||
$Dispatcher->dispatch(new CakeRequest('test_plugin/flash/plugin_test.swf'));
|
||||
|
@ -1304,13 +1304,13 @@ class DispatcherTest extends CakeTestCase {
|
|||
$Dispatcher->asset('plugin_js/js/plugin_js.js');
|
||||
$result = ob_get_clean();
|
||||
$expected = "alert('win sauce');";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
ob_start();
|
||||
$Dispatcher->asset('plugin_js/js/one/plugin_one.js');
|
||||
$result = ob_get_clean();
|
||||
$expected = "alert('plugin one nested js file');";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
ob_start();
|
||||
$Dispatcher->asset('test_plugin/css/unknown.extension');
|
||||
|
@ -1406,7 +1406,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
$cached = preg_replace('/<!--+[^<>]+-->/', '', $cached);
|
||||
$expected = str_replace(array("\t", "\r\n", "\n"), "", $cached);
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$filename = $this->__cachePath($request->here);
|
||||
unlink($filename);
|
||||
|
@ -1428,7 +1428,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
$cached = preg_replace('/<!--+[^<>]+-->/', '', $cached);
|
||||
$expected = str_replace(array("\t", "\r\n", "\n"), "", $cached);
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$filename = $this->__cachePath($request->here);
|
||||
unlink($filename);
|
||||
|
||||
|
@ -1446,7 +1446,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
$cached = preg_replace('/<!--+[^<>]+-->/', '', $cached);
|
||||
$expected = str_replace(array("\t", "\r\n", "\n"), "", $cached);
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$filename = $this->__cachePath($request->here);
|
||||
unlink($filename);
|
||||
|
||||
|
@ -1464,7 +1464,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
$cached = preg_replace('/<!--+[^<>]+-->/', '', $cached);
|
||||
$expected = str_replace(array("\t", "\r\n", "\n"), "", $cached);
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$filename = $this->__cachePath($request->here);
|
||||
unlink($filename);
|
||||
|
||||
|
@ -1482,7 +1482,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
$cached = preg_replace('/<!--+[^<>]+-->/', '', $cached);
|
||||
$expected = str_replace(array("\t", "\r\n", "\n"), "", $cached);
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$filename = $this->__cachePath($request->here);
|
||||
unlink($filename);
|
||||
|
||||
|
@ -1500,7 +1500,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
$cached = preg_replace('/<!--+[^<>]+-->/', '', $cached);
|
||||
$expected = str_replace(array("\t", "\r\n", "\n"), "", $cached);
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$filename = $this->__cachePath($request->here);
|
||||
$this->assertTrue(file_exists($filename));
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class CakeRouteTestCase extends CakeTestCase {
|
|||
$route = new CakeRoute('/', array('controller' => 'pages', 'action' => 'display', 'home'));
|
||||
$result = $route->compile();
|
||||
$expected = '#^/*$#';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertEqual($route->keys, array());
|
||||
|
||||
$route = new CakeRoute('/:controller/:action', array('controller' => 'posts'));
|
||||
|
@ -178,7 +178,7 @@ class CakeRouteTestCase extends CakeTestCase {
|
|||
$this->assertEqual($result['month'], '08');
|
||||
$this->assertEqual($result['day'], '01');
|
||||
$this->assertEquals($result['pass'][0], 'title-of-post');
|
||||
|
||||
|
||||
|
||||
$route = new CakeRoute(
|
||||
"/:extra/page/:slug/*",
|
||||
|
@ -287,7 +287,7 @@ class CakeRouteTestCase extends CakeTestCase {
|
|||
$url = array('controller' => 'subscribe', 'admin' => true, 'action' => 'edit', 1);
|
||||
$result = $route->match($url);
|
||||
$expected = '/admin/subscriptions/edit/1';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -486,8 +486,8 @@ class CakeRouteTestCase extends CakeTestCase {
|
|||
*/
|
||||
function testPatternOnAction() {
|
||||
$route = new CakeRoute(
|
||||
'/blog/:action/*',
|
||||
array('controller' => 'blog_posts'),
|
||||
'/blog/:action/*',
|
||||
array('controller' => 'blog_posts'),
|
||||
array('action' => 'other|actions')
|
||||
);
|
||||
$result = $route->match(array('controller' => 'blog_posts', 'action' => 'foo'));
|
||||
|
@ -646,7 +646,7 @@ class CakeRouteTestCase extends CakeTestCase {
|
|||
),
|
||||
'pass' => array(),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $route->parse('/tests/action/theanswer[is]:42/var[]:val2/var[]:val3');
|
||||
$expected = array(
|
||||
|
@ -663,7 +663,7 @@ class CakeRouteTestCase extends CakeTestCase {
|
|||
),
|
||||
'pass' => array(),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $route->parse('/tests/action/theanswer[is][not]:42/theanswer[]:5/theanswer[is]:6');
|
||||
$expected = array(
|
||||
|
@ -680,7 +680,7 @@ class CakeRouteTestCase extends CakeTestCase {
|
|||
),
|
||||
'pass' => array(),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -702,4 +702,4 @@ class CakeRouteTestCase extends CakeTestCase {
|
|||
);
|
||||
$this->assertEquals($expected, $result, 'Slug should have moved');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -279,7 +279,7 @@ class ControllerTestCaseTest extends CakeTestCase {
|
|||
$result = $this->Case->testAction('/tests_apps/index.json', array('return' => 'view'));
|
||||
$result = json_decode($result, true);
|
||||
$expected = array('cakephp' => 'cool');
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
include CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS . 'routes.php';
|
||||
$result = $this->Case->testAction('/some_alias');
|
||||
|
|
|
@ -250,7 +250,7 @@ class DebuggerTest extends CakeTestCase {
|
|||
|
||||
$result = str_replace(array("\t", "\r\n", "\n"), "", $result);
|
||||
$expected = str_replace(array("\t", "\r\n", "\n"), "", $expected);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,11 +41,11 @@ class FolderTest extends CakeTestCase {
|
|||
|
||||
$result = Folder::addPathElement($path, 'test');
|
||||
$expected = $path . DS . 'test';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Folder->cd(ROOT);
|
||||
$expected = ROOT;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $Folder->cd(ROOT . DS . 'non-existent');
|
||||
$this->assertFalse($result);
|
||||
|
@ -303,7 +303,7 @@ class FolderTest extends CakeTestCase {
|
|||
$Folder->path = TMP . DS . 'non-existent';
|
||||
$expected = array(array(), array());
|
||||
$result = $Folder->read(true, true);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -348,11 +348,11 @@ class FolderTest extends CakeTestCase {
|
|||
|
||||
$result = $Folder->tree(CAKE . 'Config', false, 'dir');
|
||||
$this->assertIdentical(array_diff($expected[0], $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected[0]), array());
|
||||
$this->assertIdentical(array_diff($expected, $result[0]), array());
|
||||
|
||||
$result = $Folder->tree(CAKE . 'Config', false, 'files');
|
||||
$this->assertIdentical(array_diff($expected[1], $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected[1]), array());
|
||||
$this->assertIdentical(array_diff($expected, $result[1]), array());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -490,28 +490,28 @@ class FolderTest extends CakeTestCase {
|
|||
$result = $Folder->find();
|
||||
$expected = array('config.php');
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected), array());
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
|
||||
$result = $Folder->find('.*', true);
|
||||
$expected = array('config.php');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $Folder->find('.*\.php');
|
||||
$expected = array('config.php');
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected), array());
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
|
||||
$result = $Folder->find('.*\.php', true);
|
||||
$expected = array('config.php');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $Folder->find('.*ig\.php');
|
||||
$expected = array('config.php');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$result = $Folder->find('config\.php');
|
||||
$expected = array('config.php');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$Folder->cd(TMP);
|
||||
$file = new File($Folder->pwd() . DS . 'paths.php', true);
|
||||
|
@ -519,12 +519,12 @@ class FolderTest extends CakeTestCase {
|
|||
$Folder->cd('testme');
|
||||
$result = $Folder->find('paths\.php');
|
||||
$expected = array();
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$Folder->cd($Folder->pwd() . '/..');
|
||||
$result = $Folder->find('paths\.php');
|
||||
$expected = array('paths.php');
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$Folder->cd(TMP);
|
||||
$Folder->delete($Folder->pwd() . DS . 'testme');
|
||||
|
@ -545,13 +545,13 @@ class FolderTest extends CakeTestCase {
|
|||
CAKE . 'Config' . DS . 'config.php'
|
||||
);
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected), array());
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
|
||||
$result = $Folder->findRecursive('(config|paths)\.php', true);
|
||||
$expected = array(
|
||||
CAKE . 'Config' . DS . 'config.php'
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$Folder->cd(TMP);
|
||||
$Folder->create($Folder->pwd() . DS . 'testme');
|
||||
|
@ -561,7 +561,7 @@ class FolderTest extends CakeTestCase {
|
|||
$Folder->cd(TMP . 'sessions');
|
||||
$result = $Folder->findRecursive('paths\.php');
|
||||
$expected = array();
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$Folder->cd(TMP . 'testme');
|
||||
$File = new File($Folder->pwd() . DS . 'my.php');
|
||||
|
@ -574,14 +574,14 @@ class FolderTest extends CakeTestCase {
|
|||
TMP . 'testme' . DS . 'paths.php'
|
||||
);
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected), array());
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
|
||||
$result = $Folder->findRecursive('(paths|my)\.php', true);
|
||||
$expected = array(
|
||||
TMP . 'testme' . DS . 'my.php',
|
||||
TMP . 'testme' . DS . 'paths.php'
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
|
||||
$Folder->cd(CAKE . 'Config');
|
||||
$Folder->cd(TMP);
|
||||
|
|
|
@ -166,59 +166,59 @@ class InflectorTest extends CakeTestCase {
|
|||
function testInflectorSlug() {
|
||||
$result = Inflector::slug('Foo Bar: Not just for breakfast any-more');
|
||||
$expected = 'Foo_Bar_Not_just_for_breakfast_any_more';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('this/is/a/path');
|
||||
$expected = 'this_is_a_path';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('Foo Bar: Not just for breakfast any-more', "-");
|
||||
$expected = 'Foo-Bar-Not-just-for-breakfast-any-more';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('Foo Bar: Not just for breakfast any-more', "+");
|
||||
$expected = 'Foo+Bar+Not+just+for+breakfast+any+more';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('Äpfel Über Öl grün ärgert groß öko', '-');
|
||||
$expected = 'Aepfel-Ueber-Oel-gruen-aergert-gross-oeko';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('The truth - and- more- news', '-');
|
||||
$expected = 'The-truth-and-more-news';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('The truth: and more news', '-');
|
||||
$expected = 'The-truth-and-more-news';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('La langue française est un attribut de souveraineté en France', '-');
|
||||
$expected = 'La-langue-francaise-est-un-attribut-de-souverainete-en-France';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('!@$#exciting stuff! - what !@-# was that?', '-');
|
||||
$expected = 'exciting-stuff-what-was-that';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('20% of profits went to me!', '-');
|
||||
$expected = '20-of-profits-went-to-me';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('#this melts your face1#2#3', '-');
|
||||
$expected = 'this-melts-your-face1-2-3';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('controller/action/りんご/1');
|
||||
$expected = 'controller_action_りんご_1';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('の話が出たので大丈夫かなあと');
|
||||
$expected = 'の話が出たので大丈夫かなあと';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('posts/view/한국어/page:1/sort:asc');
|
||||
$expected = 'posts_view_한국어_page_1_sort_asc';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -231,11 +231,11 @@ class InflectorTest extends CakeTestCase {
|
|||
Inflector::rules('transliteration', array('/r/' => '1'));
|
||||
$result = Inflector::slug('replace every r');
|
||||
$expected = '1eplace_eve1y_1';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Inflector::slug('replace every r', '_');
|
||||
$expected = '1eplace_eve1y_1';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -248,7 +248,7 @@ class InflectorTest extends CakeTestCase {
|
|||
Inflector::rules('transliteration', array('/å/' => 'aa', '/ø/' => 'oe'));
|
||||
$result = Inflector::slug('Testing æ ø å', '-');
|
||||
$expected = 'Testing-ae-oe-aa';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -131,47 +131,47 @@ class SanitizeTest extends CakeTestCase {
|
|||
$string = 'test & "quote" \'other\' ;.$ symbol.' . "\r" . 'another line';
|
||||
$expected = 'test & "quote" 'other' ;.$ symbol.another line';
|
||||
$result = Sanitize::clean($string, array('connection' => 'test'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'test & "quote" \'other\' ;.$ symbol.' . "\r" . 'another line';
|
||||
$expected = 'test & ' . Sanitize::escape('"quote"', 'test') . ' ' . Sanitize::escape('\'other\'', 'test') . ' ;.$ symbol.another line';
|
||||
$result = Sanitize::clean($string, array('encode' => false, 'connection' => 'test'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'test & "quote" \'other\' ;.$ \\$ symbol.' . "\r" . 'another line';
|
||||
$expected = 'test & "quote" \'other\' ;.$ $ symbol.another line';
|
||||
$result = Sanitize::clean($string, array('encode' => false, 'escape' => false, 'connection' => 'test'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'test & "quote" \'other\' ;.$ \\$ symbol.' . "\r" . 'another line';
|
||||
$expected = 'test & "quote" \'other\' ;.$ \\$ symbol.another line';
|
||||
$result = Sanitize::clean($string, array('encode' => false, 'escape' => false, 'dollar' => false, 'connection' => 'test'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'test & "quote" \'other\' ;.$ symbol.' . "\r" . 'another line';
|
||||
$expected = 'test & "quote" \'other\' ;.$ symbol.' . "\r" . 'another line';
|
||||
$result = Sanitize::clean($string, array('encode' => false, 'escape' => false, 'carriage' => false, 'connection' => 'test'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$array = array(array('test & "quote" \'other\' ;.$ symbol.' . "\r" . 'another line'));
|
||||
$expected = array(array('test & "quote" 'other' ;.$ symbol.another line'));
|
||||
$result = Sanitize::clean($array, array('connection' => 'test'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$array = array(array('test & "quote" \'other\' ;.$ \\$ symbol.' . "\r" . 'another line'));
|
||||
$expected = array(array('test & "quote" \'other\' ;.$ $ symbol.another line'));
|
||||
$result = Sanitize::clean($array, array('encode' => false, 'escape' => false, 'connection' => 'test'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$array = array(array('test odd Ä spacesé'));
|
||||
$expected = array(array('test odd Ä spacesé'));
|
||||
$result = Sanitize::clean($array, array('odd_spaces' => false, 'escape' => false, 'connection' => 'test'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$array = array(array('\\$', array('key' => 'test & "quote" \'other\' ;.$ \\$ symbol.' . "\r" . 'another line')));
|
||||
$expected = array(array('$', array('key' => 'test & "quote" \'other\' ;.$ $ symbol.another line')));
|
||||
$result = Sanitize::clean($array, array('encode' => false, 'escape' => false));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '';
|
||||
$expected = '';
|
||||
|
@ -212,36 +212,36 @@ class SanitizeTest extends CakeTestCase {
|
|||
$string = '<p>This is a <em>test string</em> & so is this</p>';
|
||||
$expected = 'This is a test string & so is this';
|
||||
$result = Sanitize::html($string, array('remove' => true));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'The "lazy" dog \'jumped\' & flew over the moon. If (1+1) = 2 <em>is</em> true, (2-1) = 1 is also true';
|
||||
$expected = 'The "lazy" dog 'jumped' & flew over the moon. If (1+1) = 2 <em>is</em> true, (2-1) = 1 is also true';
|
||||
$result = Sanitize::html($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'The "lazy" dog \'jumped\'';
|
||||
$expected = 'The "lazy" dog \'jumped\'';
|
||||
$result = Sanitize::html($string, array('quotes' => ENT_COMPAT));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'The "lazy" dog \'jumped\'';
|
||||
$result = Sanitize::html($string, array('quotes' => ENT_NOQUOTES));
|
||||
$this->assertEqual($result, $string);
|
||||
|
||||
|
||||
$string = 'The "lazy" dog \'jumped\' & flew over the moon. If (1+1) = 2 <em>is</em> true, (2-1) = 1 is also true';
|
||||
$expected = 'The "lazy" dog 'jumped' & flew over the moon. If (1+1) = 2 <em>is</em> true, (2-1) = 1 is also true';
|
||||
$result = Sanitize::html($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'The "lazy" dog & his friend Apple® conquered the world';
|
||||
$expected = 'The "lazy" dog & his friend Apple&reg; conquered the world';
|
||||
$result = Sanitize::html($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'The "lazy" dog & his friend Apple® conquered the world';
|
||||
$expected = 'The "lazy" dog & his friend Apple® conquered the world';
|
||||
$result = Sanitize::html($string, array('double' => false));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,7 +254,7 @@ class SanitizeTest extends CakeTestCase {
|
|||
$string = "This sentence \t\t\t has lots of \n\n white\nspace \rthat \r\n needs to be \t \n trimmed.";
|
||||
$expected = "This sentence has lots of whitespace that needs to be trimmed.";
|
||||
$result = Sanitize::stripWhitespace($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,7 +267,7 @@ class SanitizeTest extends CakeTestCase {
|
|||
$string = 'I would like to !%@#% & dance & sing ^$&*()-+';
|
||||
$expected = 'Iwouldliketodancesing';
|
||||
$result = Sanitize::paranoid($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = array('This |s th% s0ng that never ends it g*es',
|
||||
'on and on my friends, b^ca#use it is the',
|
||||
|
@ -276,27 +276,27 @@ class SanitizeTest extends CakeTestCase {
|
|||
'on and on my friends bcause it is the',
|
||||
'sog tht never ends.');
|
||||
$result = Sanitize::paranoid($string, array('%', '*', '.', ' '));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = "anything' OR 1 = 1";
|
||||
$expected = 'anythingOR11';
|
||||
$result = Sanitize::paranoid($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = "x' AND email IS NULL; --";
|
||||
$expected = 'xANDemailISNULL';
|
||||
$result = Sanitize::paranoid($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = "x' AND 1=(SELECT COUNT(*) FROM users); --";
|
||||
$expected = "xAND1SELECTCOUNTFROMusers";
|
||||
$result = Sanitize::paranoid($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = "x'; DROP TABLE members; --";
|
||||
$expected = "xDROPTABLEmembers";
|
||||
$result = Sanitize::paranoid($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -309,22 +309,22 @@ class SanitizeTest extends CakeTestCase {
|
|||
$string = '<img src="/img/test.jpg" alt="my image" />';
|
||||
$expected = 'my image<br />';
|
||||
$result = Sanitize::stripImages($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<img src="javascript:alert(\'XSS\');" />';
|
||||
$expected = '';
|
||||
$result = Sanitize::stripImages($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<a href="http://www.badsite.com/phising"><img src="/img/test.jpg" alt="test image alt" title="test image title" id="myImage" class="image-left"/></a>';
|
||||
$expected = '<a href="http://www.badsite.com/phising">test image alt</a><br />';
|
||||
$result = Sanitize::stripImages($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<a onclick="medium()" href="http://example.com"><img src="foobar.png" onclick="evilFunction(); return false;"/></a>';
|
||||
$expected = '<a onclick="medium()" href="http://example.com"></a>';
|
||||
$result = Sanitize::stripImages($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -337,50 +337,50 @@ class SanitizeTest extends CakeTestCase {
|
|||
$string = '<link href="/css/styles.css" media="screen" rel="stylesheet" />';
|
||||
$expected = '';
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<link href="/css/styles.css" media="screen" rel="stylesheet" />' . "\n" . '<link rel="icon" href="/favicon.ico" type="image/x-icon" />' . "\n" . '<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />' . "\n" . '<link rel="alternate" href="/feed.xml" title="RSS Feed" type="application/rss+xml" />';
|
||||
$expected = "\n" . '<link rel="icon" href="/favicon.ico" type="image/x-icon" />' . "\n" . '<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />'."\n".'<link rel="alternate" href="/feed.xml" title="RSS Feed" type="application/rss+xml" />';
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<script type="text/javascript"> alert("hacked!");</script>';
|
||||
$expected = '';
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<script> alert("hacked!");</script>';
|
||||
$expected = '';
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<style>#content { display:none; }</style>';
|
||||
$expected = '';
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<style type="text/css"><!-- #content { display:none; } --></style>';
|
||||
$expected = '';
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = <<<HTML
|
||||
text
|
||||
<style type="text/css">
|
||||
<!--
|
||||
#content { display:none; }
|
||||
<!--
|
||||
#content { display:none; }
|
||||
-->
|
||||
</style>
|
||||
text
|
||||
HTML;
|
||||
$expected = "text\n\ntext";
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = <<<HTML
|
||||
text
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
<!--
|
||||
alert('wooo');
|
||||
-->
|
||||
</script>
|
||||
|
@ -388,7 +388,7 @@ text
|
|||
HTML;
|
||||
$expected = "text\n\ntext";
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -401,17 +401,17 @@ HTML;
|
|||
$string = '<img """><script>alert("xss")</script>"/>';
|
||||
$expected ='"/>';
|
||||
$result = Sanitize::stripAll($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<IMG SRC=javascript:alert('XSS')>';
|
||||
$expected = '';
|
||||
$result = Sanitize::stripAll($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<<script>alert("XSS");//<</script>';
|
||||
$expected = '<';
|
||||
$result = Sanitize::stripAll($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<img src="http://google.com/images/logo.gif" onload="window.location=\'http://sam.com/\'" />'."\n".
|
||||
"<p>This is ok \t\n text</p>\n".
|
||||
|
@ -419,7 +419,7 @@ HTML;
|
|||
'<script src="xss.js" type="text/javascript" charset="utf-8"></script>';
|
||||
$expected = '<p>This is ok text</p>';
|
||||
$result = Sanitize::stripAll($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
|
@ -433,37 +433,37 @@ HTML;
|
|||
$string = '<h2>Headline</h2><p><a href="http://example.com">My Link</a> could go to a bad site</p>';
|
||||
$expected = 'Headline<p>My Link could go to a bad site</p>';
|
||||
$result = Sanitize::stripTags($string, 'h2', 'a');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<script type="text/javascript" src="http://evildomain.com"> </script>';
|
||||
$expected = ' ';
|
||||
$result = Sanitize::stripTags($string, 'script');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<h2>Important</h2><p>Additional information here <a href="/about"><img src="/img/test.png" /></a>. Read even more here</p>';
|
||||
$expected = 'Important<p>Additional information here <img src="/img/test.png" />. Read even more here</p>';
|
||||
$result = Sanitize::stripTags($string, 'h2', 'a');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<h2>Important</h2><p>Additional information here <a href="/about"><img src="/img/test.png" /></a>. Read even more here</p>';
|
||||
$expected = 'Important<p>Additional information here . Read even more here</p>';
|
||||
$result = Sanitize::stripTags($string, 'h2', 'a', 'img');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<b>Important message!</b><br>This message will self destruct!';
|
||||
$expected = 'Important message!<br>This message will self destruct!';
|
||||
$result = Sanitize::stripTags($string, 'b');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<b>Important message!</b><br />This message will self destruct!';
|
||||
$expected = 'Important message!<br />This message will self destruct!';
|
||||
$result = Sanitize::stripTags($string, 'b');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<h2 onclick="alert(\'evil\'); onmouseover="badness()">Important</h2><p>Additional information here <a href="/about"><img src="/img/test.png" /></a>. Read even more here</p>';
|
||||
$expected = 'Important<p>Additional information here . Read even more here</p>';
|
||||
$result = Sanitize::stripTags($string, 'h2', 'a', 'img');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -494,7 +494,7 @@ HTML;
|
|||
));
|
||||
Sanitize::formatColumns($this->DataTest);
|
||||
$result = $this->DataTest->data;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Article = new SanitizeArticle(array('alias' => 'Article'));
|
||||
$data = array('Article' => array(
|
||||
|
@ -514,6 +514,6 @@ HTML;
|
|||
));
|
||||
Sanitize::formatColumns($this->Article);
|
||||
$result = $this->Article->data;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ class SetTest extends CakeTestCase {
|
|||
function testFilter() {
|
||||
$result = Set::filter(array('0', false, true, 0, array('one thing', 'I can tell you', 'is you got to be', false)));
|
||||
$expected = array('0', 2 => true, 3 => 0, 4 => array('one thing', 'I can tell you', 'is you got to be'));
|
||||
$this->assertSame($result, $expected);
|
||||
$this->assertSame($expected, $result);
|
||||
|
||||
$result = Set::filter(array(1, array(false)));
|
||||
$expected = array(1);
|
||||
|
@ -369,7 +369,7 @@ class SetTest extends CakeTestCase {
|
|||
array('employees' => array(array('name' => array()))),
|
||||
array('employees' => array(array('name' => array())))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -956,8 +956,8 @@ class SetTest extends CakeTestCase {
|
|||
);
|
||||
$result = Set::extract('/ParentNode/name', $hasMany);
|
||||
$expected = array('Second');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
array(
|
||||
'Category' => array(
|
||||
|
@ -990,7 +990,7 @@ class SetTest extends CakeTestCase {
|
|||
)
|
||||
);
|
||||
$result = Set::extract('/Category[id=1]/..', $data);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1198,14 +1198,14 @@ class SetTest extends CakeTestCase {
|
|||
$expected = array(1, 2, 3);
|
||||
$r = Set::extract('/User/id', $nonZero);
|
||||
$this->assertEqual($r, $expected);
|
||||
|
||||
|
||||
$expected = array(
|
||||
array('User' => array('id' => 1, 'name' => 'John')),
|
||||
array('User' => array('id' => 2, 'name' => 'Bob')),
|
||||
array('User' => array('id' => 3, 'name' => 'Tony')),
|
||||
);
|
||||
$result = Set::extract('/User', $nonZero);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$nonSequential = array(
|
||||
'User' => array(
|
||||
|
@ -1231,13 +1231,13 @@ class SetTest extends CakeTestCase {
|
|||
$this->assertEqual(Set::extract('/User/id', $nonSequential), $expected);
|
||||
|
||||
$result = Set::extract('/User/id', $nonZero);
|
||||
$this->assertEqual($result, $expected, 'Failed non zero array key extract');
|
||||
$this->assertEqual($expected, $result, 'Failed non zero array key extract');
|
||||
|
||||
$expected = array(1, 2, 3, 4, 5);
|
||||
$this->assertEqual(Set::extract('/User/id', $nonSequential), $expected);
|
||||
|
||||
$result = Set::extract('/User/id', $nonZero);
|
||||
$this->assertEqual($result, $expected, 'Failed non zero array key extract');
|
||||
$this->assertEqual($expected, $result, 'Failed non zero array key extract');
|
||||
|
||||
$startingAtOne = array(
|
||||
'Article' => array(
|
||||
|
@ -1250,7 +1250,7 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$expected = array(0 => array('Article' => array('id' => 1, 'approved' => 1)));
|
||||
$result = Set::extract('/Article[approved=1]', $startingAtOne);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$items = array(
|
||||
240 => array(
|
||||
|
@ -1270,7 +1270,7 @@ class SetTest extends CakeTestCase {
|
|||
);
|
||||
|
||||
$result = Set::extract('/B/field1', $items);
|
||||
$this->assertIdentical($result, $expected);
|
||||
$this->assertIdentical($expected, $result);
|
||||
$this->assertIdentical($result, Set::extract('{n}.B.field1', $items));
|
||||
}
|
||||
/**
|
||||
|
@ -1307,7 +1307,7 @@ class SetTest extends CakeTestCase {
|
|||
array('node' => array('foo')),
|
||||
'bar'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'node' => array(
|
||||
|
@ -1320,7 +1320,7 @@ class SetTest extends CakeTestCase {
|
|||
array('foo' => array('bar')),
|
||||
array('bar' => array('foo')),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$data = array(
|
||||
'node' => array(
|
||||
|
@ -1335,7 +1335,7 @@ class SetTest extends CakeTestCase {
|
|||
array('foo' => array('bar')),
|
||||
'foo'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1447,19 +1447,19 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$result = Set::extract($a, '{n}.Article.id');
|
||||
$expected = array( 1, 2, 3 );
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '{n}.Article.title');
|
||||
$expected = array( 'Article 1', 'Article 2', 'Article 3' );
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '1.Article.title');
|
||||
$expected = 'Article 2';
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '3.Article.title');
|
||||
$expected = null;
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array(
|
||||
array(
|
||||
|
@ -1478,7 +1478,7 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$result = Set::extract($a, '{n}.Article.User.username');
|
||||
$expected = array( 'mariano.iglesias', 'mariano.iglesias', 'phpnut' );
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array(
|
||||
array(
|
||||
|
@ -1505,7 +1505,7 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$result = Set::extract($a, '{n}.Article.Comment.{n}.id');
|
||||
$expected = array (array(10, 11, 12), array(13, 14), null);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '{n}.Article.Comment.{n}.title');
|
||||
$expected = array(
|
||||
|
@ -1513,12 +1513,12 @@ class SetTest extends CakeTestCase {
|
|||
array('Comment 13', 'Comment 14'),
|
||||
null
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array(array('1day' => '20 sales'), array('1day' => '2 sales'));
|
||||
$result = Set::extract($a, '{n}.1day');
|
||||
$expected = array('20 sales', '2 sales');
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array(
|
||||
'pages' => array('name' => 'page'),
|
||||
|
@ -1527,7 +1527,7 @@ class SetTest extends CakeTestCase {
|
|||
);
|
||||
$result = Set::extract($a, '{s}.name');
|
||||
$expected = array('page','fruit');
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array(
|
||||
0 => array('pages' => array('name' => 'page')),
|
||||
|
@ -1538,11 +1538,11 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$result = Set::extract($a, '{n}.{s}.name');
|
||||
$expected = array(0 => array('page'), 1 => array('fruit'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '{s}.{n}.name');
|
||||
$expected = array(array('jippi'), array('jippi'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '{\w+}.{\w+}.name');
|
||||
$expected = array(
|
||||
|
@ -1551,34 +1551,34 @@ class SetTest extends CakeTestCase {
|
|||
'test' => array('jippi'),
|
||||
'dot.test' => array('jippi')
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '{\d+}.{\w+}.name');
|
||||
$expected = array(array('pages' => 'page'), array('fruites' => 'fruit'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '{n}.{\w+}.name');
|
||||
$expected = array(array('pages' => 'page'), array('fruites' => 'fruit'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '{s}.{\d+}.name');
|
||||
$expected = array(array('jippi'), array('jippi'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '{s}');
|
||||
$expected = array(array(array('name' => 'jippi')), array(array('name' => 'jippi')));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '{[a-z]}');
|
||||
$expected = array(
|
||||
'test' => array(array('name' => 'jippi')),
|
||||
'dot.test' => array(array('name' => 'jippi'))
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, '{dot\.test}.{n}');
|
||||
$expected = array('dot.test' => array(array('name' => 'jippi')));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = new stdClass();
|
||||
$a->articles = array(
|
||||
|
@ -1589,11 +1589,11 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$result = Set::extract($a, 'articles.{n}.Article.id');
|
||||
$expected = array(1, 2, 3);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::extract($a, 'articles.{n}.Article.title');
|
||||
$expected = array('Article 1', 'Article 2', 'Article 3');
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1612,7 +1612,7 @@ class SetTest extends CakeTestCase {
|
|||
'pages' => array('name' => 'page'),
|
||||
'files' => array('name' => 'files')
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array(
|
||||
'pages' => array('name' => 'page')
|
||||
|
@ -1621,7 +1621,7 @@ class SetTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'pages' => array('name' => array()),
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array(
|
||||
'pages' => array(
|
||||
|
@ -1637,7 +1637,7 @@ class SetTest extends CakeTestCase {
|
|||
1 => array('name' => 'about', 'vars' => array('title' => 'page title'))
|
||||
)
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1656,7 +1656,7 @@ class SetTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'pages' => array('name' => 'page')
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array(
|
||||
'pages' => array(
|
||||
|
@ -1672,11 +1672,11 @@ class SetTest extends CakeTestCase {
|
|||
1 => array('name' => 'about')
|
||||
)
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::remove($a, 'pages.2.vars', array('title' => 'page title'));
|
||||
$expected = $a;
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1741,15 +1741,15 @@ class SetTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
2 => array('name' => 'contact')
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::diff($a, array());
|
||||
$expected = $a;
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::diff(array(), $b);
|
||||
$expected = $b;
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$b = array(
|
||||
0 => array('name' => 'me'),
|
||||
|
@ -1760,7 +1760,7 @@ class SetTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
0 => array('name' => 'main')
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array();
|
||||
$b = array('name' => 'bob', 'address' => 'home');
|
||||
|
@ -1777,31 +1777,31 @@ class SetTest extends CakeTestCase {
|
|||
$b = array('key' => 1, 'another' => 0);
|
||||
$expected = array('name' => 'me');
|
||||
$result = Set::diff($a, $b);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array('key' => 'value', 'another' => null, 'name' => 'me');
|
||||
$b = array('key' => 'differentValue', 'another' => null);
|
||||
$expected = array('key' => 'value', 'name' => 'me');
|
||||
$result = Set::diff($a, $b);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array('key' => 'value', 'another' => null, 'name' => 'me');
|
||||
$b = array('key' => 'differentValue', 'another' => 'value');
|
||||
$expected = array('key' => 'value', 'another' => null, 'name' => 'me');
|
||||
$result = Set::diff($a, $b);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array('key' => 'value', 'another' => null, 'name' => 'me');
|
||||
$b = array('key' => 'differentValue', 'another' => 'value');
|
||||
$expected = array('key' => 'differentValue', 'another' => 'value', 'name' => 'me');
|
||||
$result = Set::diff($b, $a);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$a = array('key' => 'value', 'another' => null, 'name' => 'me');
|
||||
$b = array(0 => 'differentValue', 1 => 'value');
|
||||
$expected = $a + $b;
|
||||
$result = Set::diff($a, $b);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1848,25 +1848,25 @@ class SetTest extends CakeTestCase {
|
|||
'Data' => array('user' => 'gwoo','name' => 'The Gwoo'))));
|
||||
$result = Set::combine($a, '{n}.User.id');
|
||||
$expected = array(2 => null, 14 => null, 25 => null);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id', '{n}.User.non-existant');
|
||||
$expected = array(2 => null, 14 => null, 25 => null);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id', '{n}.User.Data');
|
||||
$expected = array(
|
||||
2 => array('user' => 'mariano.iglesias', 'name' => 'Mariano Iglesias'),
|
||||
14 => array('user' => 'phpnut', 'name' => 'Larry E. Masters'),
|
||||
25 => array('user' => 'gwoo', 'name' => 'The Gwoo'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id', '{n}.User.Data.name');
|
||||
$expected = array(
|
||||
2 => 'Mariano Iglesias',
|
||||
14 => 'Larry E. Masters',
|
||||
25 => 'The Gwoo');
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id', '{n}.User.Data', '{n}.User.group_id');
|
||||
$expected = array(
|
||||
|
@ -1875,7 +1875,7 @@ class SetTest extends CakeTestCase {
|
|||
25 => array('user' => 'gwoo', 'name' => 'The Gwoo')),
|
||||
2 => array(
|
||||
14 => array('user' => 'phpnut', 'name' => 'Larry E. Masters')));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id', '{n}.User.Data.name', '{n}.User.group_id');
|
||||
$expected = array(
|
||||
|
@ -1884,22 +1884,22 @@ class SetTest extends CakeTestCase {
|
|||
25 => 'The Gwoo'),
|
||||
2 => array(
|
||||
14 => 'Larry E. Masters'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id');
|
||||
$expected = array(2 => null, 14 => null, 25 => null);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id', '{n}.User.Data');
|
||||
$expected = array(
|
||||
2 => array('user' => 'mariano.iglesias', 'name' => 'Mariano Iglesias'),
|
||||
14 => array('user' => 'phpnut', 'name' => 'Larry E. Masters'),
|
||||
25 => array('user' => 'gwoo', 'name' => 'The Gwoo'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id', '{n}.User.Data.name');
|
||||
$expected = array(2 => 'Mariano Iglesias', 14 => 'Larry E. Masters', 25 => 'The Gwoo');
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id', '{n}.User.Data', '{n}.User.group_id');
|
||||
$expected = array(
|
||||
|
@ -1908,7 +1908,7 @@ class SetTest extends CakeTestCase {
|
|||
25 => array('user' => 'gwoo', 'name' => 'The Gwoo')),
|
||||
2 => array(
|
||||
14 => array('user' => 'phpnut', 'name' => 'Larry E. Masters')));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id', '{n}.User.Data.name', '{n}.User.group_id');
|
||||
$expected = array(
|
||||
|
@ -1917,7 +1917,7 @@ class SetTest extends CakeTestCase {
|
|||
25 => 'The Gwoo'),
|
||||
2 => array(
|
||||
14 => 'Larry E. Masters'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, '{n}.User.id', array('{0}: {1}', '{n}.User.Data.user', '{n}.User.Data.name'), '{n}.User.group_id');
|
||||
$expected = array (
|
||||
|
@ -1925,23 +1925,23 @@ class SetTest extends CakeTestCase {
|
|||
2 => 'mariano.iglesias: Mariano Iglesias',
|
||||
25 => 'gwoo: The Gwoo'),
|
||||
2 => array (14 => 'phpnut: Larry E. Masters'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, array('{0}: {1}', '{n}.User.Data.user', '{n}.User.Data.name'), '{n}.User.id');
|
||||
$expected = array('mariano.iglesias: Mariano Iglesias' => 2, 'phpnut: Larry E. Masters' => 14, 'gwoo: The Gwoo' => 25);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, array('{1}: {0}', '{n}.User.Data.user', '{n}.User.Data.name'), '{n}.User.id');
|
||||
$expected = array('Mariano Iglesias: mariano.iglesias' => 2, 'Larry E. Masters: phpnut' => 14, 'The Gwoo: gwoo' => 25);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, array('%1$s: %2$d', '{n}.User.Data.user', '{n}.User.id'), '{n}.User.Data.name');
|
||||
$expected = array('mariano.iglesias: 2' => 'Mariano Iglesias', 'phpnut: 14' => 'Larry E. Masters', 'gwoo: 25' => 'The Gwoo');
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, array('%2$d: %1$s', '{n}.User.Data.user', '{n}.User.id'), '{n}.User.Data.name');
|
||||
$expected = array('2: mariano.iglesias' => 'Mariano Iglesias', '14: phpnut' => 'Larry E. Masters', '25: gwoo' => 'The Gwoo');
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$b = new stdClass();
|
||||
$b->users = array(
|
||||
|
@ -1953,11 +1953,11 @@ class SetTest extends CakeTestCase {
|
|||
'Data' => array('user' => 'gwoo','name' => 'The Gwoo'))));
|
||||
$result = Set::combine($b, 'users.{n}.User.id');
|
||||
$expected = array(2 => null, 14 => null, 25 => null);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($b, 'users.{n}.User.id', 'users.{n}.User.non-existant');
|
||||
$expected = array(2 => null, 14 => null, 25 => null);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::combine($a, 'fail', 'fail');
|
||||
$this->assertEqual($result, array());
|
||||
|
@ -1996,7 +1996,7 @@ class SetTest extends CakeTestCase {
|
|||
$this->assertEqual($map->Array2[0]->Array2Data1, $expected['Array2'][0]['Array2Data1']);
|
||||
|
||||
$result = Set::reverse($map);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$expected = array(
|
||||
'Post' => array('id'=> 1, 'title' => 'First Post'),
|
||||
|
@ -2037,7 +2037,7 @@ class SetTest extends CakeTestCase {
|
|||
4 => array('Array3Data1' => 5, 'Array3Data2' => 'Array3Data2 value 2', 'Array3Data3' => 'Array3Data3 value 2', 'Array3Data4' => 'Array3Data4 value 4')));
|
||||
$map = Set::map($expected, true);
|
||||
$result = Set::reverse($map);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$expected = array(
|
||||
'Array1' => array(
|
||||
|
@ -2066,12 +2066,12 @@ class SetTest extends CakeTestCase {
|
|||
'some3' => 'thing else');
|
||||
$map = Set::map($expected, true);
|
||||
$result = Set::reverse($map);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$expected = array('User' => array('psword'=> 'whatever', 'Icon' => array('id'=> 851)));
|
||||
$map = Set::map($expected);
|
||||
$result = Set::reverse($map);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$expected = array('User' => array('psword'=> 'whatever', 'Icon' => array('id'=> 851)));
|
||||
$class = new stdClass;
|
||||
|
@ -2080,7 +2080,7 @@ class SetTest extends CakeTestCase {
|
|||
$class->User->Icon = new stdClass;
|
||||
$class->User->Icon->id = 851;
|
||||
$result = Set::reverse($class);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$expected = array('User' => array('psword'=> 'whatever', 'Icon' => array('id'=> 851), 'Profile' => array('name' => 'Some Name', 'address' => 'Some Address')));
|
||||
$class = new stdClass;
|
||||
|
@ -2093,7 +2093,7 @@ class SetTest extends CakeTestCase {
|
|||
$class->User->Profile->address = 'Some Address';
|
||||
|
||||
$result = Set::reverse($class);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$expected = array('User' => array('psword'=> 'whatever',
|
||||
'Icon' => array('id'=> 851),
|
||||
|
@ -2129,7 +2129,7 @@ class SetTest extends CakeTestCase {
|
|||
$class->User->Comment->{'1'}->updated = '2007-03-18 10:49:31';
|
||||
|
||||
$result = Set::reverse($class);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$expected = array('User' => array('psword'=> 'whatever',
|
||||
'Icon' => array('id'=> 851),
|
||||
|
@ -2165,7 +2165,7 @@ class SetTest extends CakeTestCase {
|
|||
$comment2->updated = '2007-03-18 10:49:31';
|
||||
$class->User->Comment = array($comment, $comment2);
|
||||
$result = Set::reverse($class);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$class = new stdClass;
|
||||
$class->User = new stdClass;
|
||||
|
@ -2176,7 +2176,7 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$result = Set::reverse($class);
|
||||
$expected = array('User' => array('id' => '100'), 'someString'=> 'this is some string', 'Profile' => array('name' => 'Joe Mamma'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$class = new stdClass;
|
||||
$class->User = new stdClass;
|
||||
|
@ -2188,7 +2188,7 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$result = Set::reverse($class);
|
||||
$expected = array('User' => array('id' => '100'), 'Profile' => array('name' => 'Joe Mamma'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2205,38 +2205,38 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$result = Set::format($data, '{1}, {0}', array('{n}.Person.first_name', '{n}.Person.last_name'));
|
||||
$expected = array('Abele, Nate', 'Masters, Larry', 'Woodworth, Garrett');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::format($data, '{0}, {1}', array('{n}.Person.last_name', '{n}.Person.first_name'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::format($data, '{0}, {1}', array('{n}.Person.city', '{n}.Person.state'));
|
||||
$expected = array('Boston, MA', 'Boondock, TN', 'Venice Beach, CA');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::format($data, '{{0}, {1}}', array('{n}.Person.city', '{n}.Person.state'));
|
||||
$expected = array('{Boston, MA}', '{Boondock, TN}', '{Venice Beach, CA}');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::format($data, '{{0}, {1}}', array('{n}.Person.something', '{n}.Person.something'));
|
||||
$expected = array('{42, 42}', '{{0}, {0}}', '{{1}, {1}}');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::format($data, '{%2$d, %1$s}', array('{n}.Person.something', '{n}.Person.something'));
|
||||
$expected = array('{42, 42}', '{0, {0}}', '{0, {1}}');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::format($data, '{%1$s, %1$s}', array('{n}.Person.something', '{n}.Person.something'));
|
||||
$expected = array('{42, 42}', '{{0}, {0}}', '{{1}, {1}}');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::format($data, '%2$d, %1$s', array('{n}.Person.first_name', '{n}.Person.something'));
|
||||
$expected = array('42, Nate', '0, Larry', '0, Garrett');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::format($data, '%1$s, %2$d', array('{n}.Person.first_name', '{n}.Person.something'));
|
||||
$expected = array('Nate, 42', 'Larry, 0', 'Garrett, 0');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2368,7 +2368,7 @@ class SetTest extends CakeTestCase {
|
|||
$this->assertEqual(get_object_vars($mapped[0]->headers), $expected[0]['IndexedPage']['headers']);
|
||||
|
||||
$result = Set::reverse($mapped);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$data = array(
|
||||
array(
|
||||
|
@ -2416,7 +2416,7 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$result = Set::map(null);
|
||||
$expected = null;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2686,7 +2686,7 @@ class SetTest extends CakeTestCase {
|
|||
$result = Set::pushDiff($array1, $array3);
|
||||
|
||||
$expected = array('ModelOne' => array('id'=>1001, 'field_one'=>'a1.m1.f1', 'field_two'=>'a1.m1.f2', 'field_three'=>'a3.m1.f3'));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
|
||||
$array1 = array(
|
||||
|
@ -2706,7 +2706,7 @@ class SetTest extends CakeTestCase {
|
|||
0 => array('ModelOne' => array('id'=>1001, 'field_one'=>'s1.0.m1.f1', 'field_two'=>'s1.0.m1.f2'),
|
||||
'ModelThree' => array('id'=>1003, 'field_one'=>'s3.0.m3.f1', 'field_two'=>'s3.0.m3.f2')),
|
||||
1 => array('ModelTwo' => array('id'=>1002, 'field_one'=>'s1.1.m2.f2', 'field_two'=>'s1.1.m2.f2')));
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Set::pushDiff($array1, null);
|
||||
$this->assertEquals($result, $array1);
|
||||
|
@ -2730,28 +2730,28 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$result = Set::apply('/Movie/rating', $data, 'array_sum');
|
||||
$expected = 9;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
|
||||
$result = Set::apply('/Movie/rating', $data, 'array_product');
|
||||
$expected = 15;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::apply('/Movie/title', $data, 'ucfirst', array('type' => 'map'));
|
||||
$expected = array('Movie 3', 'Movie 1', 'Movie 2');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::apply('/Movie/title', $data, 'strtoupper', array('type' => 'map'));
|
||||
$expected = array('MOVIE 3', 'MOVIE 1', 'MOVIE 2');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::apply('/Movie/rating', $data, array('SetTest', '_method'), array('type' => 'reduce'));
|
||||
$expected = 9;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = Set::apply('/Movie/rating', $data, 'strtoupper', array('type' => 'non existing type'));
|
||||
$expected = null;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2828,13 +2828,13 @@ class SetTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$string ='<data><post title="Title of this post" description="cool"/></data>';
|
||||
|
||||
$xml = Xml::build($string);
|
||||
$result = Set::reverse($xml);
|
||||
$expected = array('data' => array('post' => array('@title' => 'Title of this post', '@description' => 'cool')));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$xml = Xml::build('<example><item><title>An example of a correctly reversed SimpleXMLElement</title><desc/></item></example>');
|
||||
$result = Set::reverse($xml);
|
||||
|
@ -2846,7 +2846,7 @@ class SetTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$xml = Xml::build('<example><item attr="123"><titles><title>title1</title><title>title2</title></titles></item></example>');
|
||||
$result = Set::reverse($xml);
|
||||
|
@ -2860,7 +2860,7 @@ class SetTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$xml = Xml::build('<example attr="ex_attr"><item attr="123"><titles>list</titles>textforitems</item></example>');
|
||||
$result = Set::reverse($xml);
|
||||
|
@ -2874,7 +2874,7 @@ class SetTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$string = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:dc="http://www.cakephp.org/">
|
||||
|
@ -2942,7 +2942,7 @@ class SetTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$text = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
<XRDS xmlns="xri://$xrds">
|
||||
|
@ -3005,7 +3005,7 @@ class SetTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3052,7 +3052,7 @@ class SetTest extends CakeTestCase {
|
|||
'1.Post.title' => 'Second Post', '1.Post.body' => 'Second Post Body', '1.Author.id' => '3',
|
||||
'1.Author.user' => 'larry', '1.Author.password' => null
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,124 +68,124 @@ class StringTest extends CakeTestCase {
|
|||
$string = 'some string';
|
||||
$expected = 'some string';
|
||||
$result = String::insert($string, array());
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '2 + 2 = :sum. Cake is :adjective.';
|
||||
$expected = '2 + 2 = 4. Cake is yummy.';
|
||||
$result = String::insert($string, array('sum' => '4', 'adjective' => 'yummy'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '2 + 2 = %sum. Cake is %adjective.';
|
||||
$result = String::insert($string, array('sum' => '4', 'adjective' => 'yummy'), array('before' => '%'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '2 + 2 = 2sum2. Cake is 9adjective9.';
|
||||
$result = String::insert($string, array('sum' => '4', 'adjective' => 'yummy'), array('format' => '/([\d])%s\\1/'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '2 + 2 = 12sum21. Cake is 23adjective45.';
|
||||
$expected = '2 + 2 = 4. Cake is 23adjective45.';
|
||||
$result = String::insert($string, array('sum' => '4', 'adjective' => 'yummy'), array('format' => '/([\d])([\d])%s\\2\\1/'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = ':web :web_site';
|
||||
$expected = 'www http';
|
||||
$result = String::insert($string, array('web' => 'www', 'web_site' => 'http'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '2 + 2 = <sum. Cake is <adjective>.';
|
||||
$expected = '2 + 2 = <sum. Cake is yummy.';
|
||||
$result = String::insert($string, array('sum' => '4', 'adjective' => 'yummy'), array('before' => '<', 'after' => '>'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '2 + 2 = \:sum. Cake is :adjective.';
|
||||
$expected = '2 + 2 = :sum. Cake is yummy.';
|
||||
$result = String::insert($string, array('sum' => '4', 'adjective' => 'yummy'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '2 + 2 = !:sum. Cake is :adjective.';
|
||||
$result = String::insert($string, array('sum' => '4', 'adjective' => 'yummy'), array('escape' => '!'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '2 + 2 = \%sum. Cake is %adjective.';
|
||||
$expected = '2 + 2 = %sum. Cake is yummy.';
|
||||
$result = String::insert($string, array('sum' => '4', 'adjective' => 'yummy'), array('before' => '%'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = ':a :b \:a :a';
|
||||
$expected = '1 2 :a 1';
|
||||
$result = String::insert($string, array('a' => 1, 'b' => 2));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = ':a :b :c';
|
||||
$expected = '2 3';
|
||||
$result = String::insert($string, array('b' => 2, 'c' => 3), array('clean' => true));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = ':a :b :c';
|
||||
$expected = '1 3';
|
||||
$result = String::insert($string, array('a' => 1, 'c' => 3), array('clean' => true));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = ':a :b :c';
|
||||
$expected = '2 3';
|
||||
$result = String::insert($string, array('b' => 2, 'c' => 3), array('clean' => true));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = ':a, :b and :c';
|
||||
$expected = '2 and 3';
|
||||
$result = String::insert($string, array('b' => 2, 'c' => 3), array('clean' => true));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '":a, :b and :c"';
|
||||
$expected = '"1, 2"';
|
||||
$result = String::insert($string, array('a' => 1, 'b' => 2), array('clean' => true));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '"${a}, ${b} and ${c}"';
|
||||
$expected = '"1, 2"';
|
||||
$result = String::insert($string, array('a' => 1, 'b' => 2), array('before' => '${', 'after' => '}', 'clean' => true));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<img src=":src" alt=":alt" class="foo :extra bar"/>';
|
||||
$expected = '<img src="foo" class="foo bar"/>';
|
||||
$result = String::insert($string, array('src' => 'foo'), array('clean' => 'html'));
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<img src=":src" class=":no :extra"/>';
|
||||
$expected = '<img src="foo"/>';
|
||||
$result = String::insert($string, array('src' => 'foo'), array('clean' => 'html'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = '<img src=":src" class=":no :extra"/>';
|
||||
$expected = '<img src="foo" class="bar"/>';
|
||||
$result = String::insert($string, array('src' => 'foo', 'extra' => 'bar'), array('clean' => 'html'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::insert("this is a ? string", "test");
|
||||
$expected = "this is a test string";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::insert("this is a ? string with a ? ? ?", array('long', 'few?', 'params', 'you know'));
|
||||
$expected = "this is a long string with a few? params you know";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::insert('update saved_urls set url = :url where id = :id', array('url' => 'http://www.testurl.com/param1:url/param2:id','id' => 1));
|
||||
$expected = "update saved_urls set url = http://www.testurl.com/param1:url/param2:id where id = 1";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::insert('update saved_urls set url = :url where id = :id', array('id' => 1, 'url' => 'http://www.testurl.com/param1:url/param2:id'));
|
||||
$expected = "update saved_urls set url = http://www.testurl.com/param1:url/param2:id where id = 1";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::insert(':me cake. :subject :verb fantastic.', array('me' => 'I :verb', 'subject' => 'cake', 'verb' => 'is'));
|
||||
$expected = "I :verb cake. cake is fantastic.";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::insert(':I.am: :not.yet: passing.', array('I.am' => 'We are'), array('before' => ':', 'after' => ':', 'clean' => array('replacement' => ' of course', 'method' => 'text')));
|
||||
$expected = "We are of course passing.";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::insert(
|
||||
':I.am: :not.yet: passing.',
|
||||
|
@ -193,31 +193,31 @@ class StringTest extends CakeTestCase {
|
|||
array('before' => ':', 'after' => ':', 'clean' => true)
|
||||
);
|
||||
$expected = "We are passing.";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::insert('?-pended result', array('Pre'));
|
||||
$expected = "Pre-pended result";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'switching :timeout / :timeout_count';
|
||||
$expected = 'switching 5 / 10';
|
||||
$result = String::insert($string, array('timeout' => 5, 'timeout_count' => 10));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'switching :timeout / :timeout_count';
|
||||
$expected = 'switching 5 / 10';
|
||||
$result = String::insert($string, array('timeout_count' => 10, 'timeout' => 5));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'switching :timeout_count by :timeout';
|
||||
$expected = 'switching 10 by 5';
|
||||
$result = String::insert($string, array('timeout' => 5, 'timeout_count' => 10));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$string = 'switching :timeout_count by :timeout';
|
||||
$expected = 'switching 10 by 5';
|
||||
$result = String::insert($string, array('timeout_count' => 10, 'timeout' => 5));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -280,15 +280,15 @@ class StringTest extends CakeTestCase {
|
|||
function testTokenize() {
|
||||
$result = String::tokenize('A,(short,boring test)');
|
||||
$expected = array('A', '(short,boring test)');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::tokenize('A,(short,more interesting( test)');
|
||||
$expected = array('A', '(short,more interesting( test)');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::tokenize('A,(short,very interesting( test))');
|
||||
$expected = array('A', '(short,very interesting( test))');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = String::tokenize('"single tag"', ' ', '"', '"');
|
||||
$expected = array('"single tag"');
|
||||
|
@ -298,7 +298,7 @@ class StringTest extends CakeTestCase {
|
|||
$expected = array('tagA', '"single tag"', 'tagB');
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
|
||||
function testReplaceWithQuestionMarkInString() {
|
||||
$string = ':a, :b and :c?';
|
||||
$expected = '2 and 3?';
|
||||
|
@ -326,7 +326,7 @@ TEXT;
|
|||
This is the song th
|
||||
at never ends. This
|
||||
is the song that n
|
||||
ever ends. This is
|
||||
ever ends. This is
|
||||
the song that never
|
||||
ends.
|
||||
TEXT;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -174,11 +174,11 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
function testDocType() {
|
||||
$result = $this->Html->docType();
|
||||
$expected = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Html->docType('html4-strict');
|
||||
$expected = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->assertNull($this->Html->docType('non-existing-doctype'));
|
||||
}
|
||||
|
@ -194,11 +194,11 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Html->link('/home');
|
||||
$expected = array('a' => array('href' => '/home'), 'preg:/\/home/', '/a');
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->link('Posts', array('controller' => 'posts', 'action' => 'index', 'full_base' => true));
|
||||
$expected = array('a' => array('href' => FULL_BASE_URL . '/posts'), 'Posts', '/a');
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->link('Home', '/home', array('confirm' => 'Are you sure you want to do this?'));
|
||||
$expected = array(
|
||||
|
@ -206,7 +206,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Home',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected, true);
|
||||
$this->assertTags($expected, $result, true);
|
||||
|
||||
$result = $this->Html->link('Home', '/home', array('default' => false));
|
||||
$expected = array(
|
||||
|
@ -214,7 +214,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Home',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->link('Next >', '#');
|
||||
$expected = array(
|
||||
|
@ -222,7 +222,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Next >',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->link('Next >', '#', array('escape' => true));
|
||||
$expected = array(
|
||||
|
@ -230,7 +230,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Next >',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->link('Next >', '#', array('escape' => 'utf-8'));
|
||||
$expected = array(
|
||||
|
@ -238,7 +238,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Next >',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->link('Next >', '#', array('escape' => false));
|
||||
$expected = array(
|
||||
|
@ -246,7 +246,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Next >',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->link('Next >', '#', array(
|
||||
'title' => 'to escape … or not escape?',
|
||||
|
@ -257,7 +257,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Next >',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->link('Next >', '#', array(
|
||||
'title' => 'to escape … or not escape?',
|
||||
|
@ -268,7 +268,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Next >',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->link('Original size', array(
|
||||
'controller' => 'images', 'action' => 'view', 3, '?' => array('height' => 100, 'width' => 200)
|
||||
|
@ -278,7 +278,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Original size',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
Configure::write('Asset.timestamp', false);
|
||||
|
||||
|
@ -288,7 +288,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'img' => array('src' => 'img/test.gif', 'alt' => ''),
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->image('test.gif', array('url' => '#'));
|
||||
$expected = array(
|
||||
|
@ -296,7 +296,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'img' => array('src' => 'img/test.gif', 'alt' => ''),
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
Configure::write('Asset.timestamp', 'force');
|
||||
|
||||
|
@ -306,7 +306,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'img' => array('src' => 'preg:/img\/..\/favicon\.ico\?\d*/', 'alt' => ''),
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->image('../favicon.ico', array('url' => '#'));
|
||||
$expected = array(
|
||||
|
@ -314,7 +314,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'img' => array('src' => 'preg:/img\/..\/favicon\.ico\?\d*/', 'alt' => ''),
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -362,7 +362,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'img' => array('src' => 'preg:/\/testing\/longer\/img\/cake\.icon\.png\?[0-9]+/', 'alt' => '')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -426,14 +426,14 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'link' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'preg:/.*theme\/test_theme\/css\/webroot_test\.css/')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$this->Html->theme = 'test_theme';
|
||||
$result = $this->Html->css('theme_webroot');
|
||||
$expected = array(
|
||||
'link' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'preg:/.*theme\/test_theme\/css\/theme_webroot\.css/')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
Configure::write('App.www_root', $webRoot);
|
||||
}
|
||||
|
@ -468,27 +468,27 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'link' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'preg:/.*css\/screen\.css/')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->css('screen.css');
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->css('my.css.library');
|
||||
$expected['link']['href'] = 'preg:/.*css\/my\.css\.library\.css/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->css('screen.css?1234');
|
||||
$expected['link']['href'] = 'preg:/.*css\/screen\.css\?1234/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->css('http://whatever.com/screen.css?1234');
|
||||
$expected['link']['href'] = 'preg:/http:\/\/.*\/screen\.css\?1234/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
Configure::write('Asset.filter.css', 'css.php');
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/.*ccss\/cake\.generic\.css/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
Configure::write('Asset.filter.css', false);
|
||||
|
||||
|
@ -528,29 +528,29 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/.*css\/cake\.generic\.css\?[0-9]+/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
Configure::write('debug', 0);
|
||||
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/.*css\/cake\.generic\.css/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
Configure::write('Asset.timestamp', 'force');
|
||||
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/.*css\/cake\.generic\.css\?[0-9]+/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$this->Html->request->webroot = '/testing/';
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/\/testing\/css\/cake\.generic\.css\?[0-9]+/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$this->Html->request->webroot = '/testing/longer/';
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/\/testing\/longer\/css\/cake\.generic\.css\?[0-9]+/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -591,7 +591,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'script' => array('type' => 'text/javascript', 'src' => 'js/foo.js')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->script(array('foobar', 'bar'));
|
||||
$expected = array(
|
||||
|
@ -600,31 +600,31 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
array('script' => array('type' => 'text/javascript', 'src' => 'js/bar.js')),
|
||||
'/script',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->script('jquery-1.3');
|
||||
$expected = array(
|
||||
'script' => array('type' => 'text/javascript', 'src' => 'js/jquery-1.3.js')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->script('test.json');
|
||||
$expected = array(
|
||||
'script' => array('type' => 'text/javascript', 'src' => 'js/test.json.js')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->script('/plugin/js/jquery-1.3.2.js?someparam=foo');
|
||||
$expected = array(
|
||||
'script' => array('type' => 'text/javascript', 'src' => '/plugin/js/jquery-1.3.2.js?someparam=foo')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->script('test.json.js?foo=bar');
|
||||
$expected = array(
|
||||
'script' => array('type' => 'text/javascript', 'src' => 'js/test.json.js?foo=bar')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->script('foo');
|
||||
$this->assertNull($result, 'Script returned upon duplicate inclusion %s');
|
||||
|
@ -639,7 +639,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'script' => array('type' => 'text/javascript', 'src' => 'js/jquery-1.3.2.js', 'defer' => 'defer', 'encoding' => 'utf-8')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$this->View->expects($this->any())->method('addScript')
|
||||
->with($this->matchesRegularExpression('/script_in_head.js/'));
|
||||
|
@ -671,7 +671,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'script' => array('src' => '/theme/test_theme/js/__test_js.js', 'type' => 'text/javascript')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$folder = new Folder(WWW_ROOT . 'theme' . DS . 'test_theme');
|
||||
$folder->delete();
|
||||
|
@ -692,7 +692,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$this->cDataEnd,
|
||||
'/script',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->scriptBlock('window.foo = 2;', array('safe' => false));
|
||||
$expected = array(
|
||||
|
@ -700,7 +700,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'window.foo = 2;',
|
||||
'/script',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->scriptBlock('window.foo = 2;', array('safe' => true));
|
||||
$expected = array(
|
||||
|
@ -710,7 +710,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$this->cDataEnd,
|
||||
'/script',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
|
||||
$this->View->expects($this->any())->method('addScript')
|
||||
|
@ -725,7 +725,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'window.foo = 2;',
|
||||
'/script',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -746,7 +746,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$this->cDataEnd,
|
||||
'/script'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
|
||||
$result = $this->Html->scriptStart(array('safe' => false));
|
||||
|
@ -759,7 +759,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'this is some javascript',
|
||||
'/script'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$this->View->expects($this->once())->method('addScript');
|
||||
$result = $this->Html->scriptStart(array('safe' => false, 'inline' => false));
|
||||
|
@ -814,7 +814,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Third',
|
||||
'/a',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->getCrumbs(' > ');
|
||||
$expected = array(
|
||||
|
@ -830,7 +830,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'Third',
|
||||
'/a',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$this->assertPattern('/^<a[^<>]+>First<\/a> > <a[^<>]+>Second<\/a> > <a[^<>]+>Third<\/a>$/', $result);
|
||||
$this->assertPattern('/<a\s+href=["\']+\#first["\']+[^<>]*>First<\/a>/', $result);
|
||||
|
@ -856,7 +856,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'»',
|
||||
'Fourth'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -914,7 +914,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'/li',
|
||||
'/ul'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->nestedList($list, null);
|
||||
$expected = array(
|
||||
|
@ -944,7 +944,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'/li',
|
||||
'/ul'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->nestedList($list, array(), array(), 'ol');
|
||||
$expected = array(
|
||||
|
@ -974,7 +974,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'/li',
|
||||
'/ol'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->nestedList($list, 'ol');
|
||||
$expected = array(
|
||||
|
@ -1004,7 +1004,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'/li',
|
||||
'/ol'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->nestedList($list, array('class'=>'list'));
|
||||
$expected = array(
|
||||
|
@ -1034,7 +1034,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'/li',
|
||||
'/ul'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->nestedList($list, array(), array('class' => 'item'));
|
||||
$expected = array(
|
||||
|
@ -1064,7 +1064,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'/li',
|
||||
'/ul'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->nestedList($list, array(), array('even' => 'even', 'odd' => 'odd'));
|
||||
$expected = array(
|
||||
|
@ -1094,7 +1094,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'/li',
|
||||
'/ul'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->nestedList($list, array('class'=>'list'), array('class' => 'item'));
|
||||
$expected = array(
|
||||
|
@ -1124,7 +1124,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'/li',
|
||||
'/ul'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1160,14 +1160,14 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'link' => array('href' => 'preg:/.*favicon\.ico/', 'rel' => 'icon'),
|
||||
array('link' => array('href' => 'preg:/.*favicon\.ico/', 'rel' => 'shortcut icon'))
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->meta('icon', 'favicon.ico');
|
||||
$expected = array(
|
||||
'link' => array('href' => 'preg:/.*favicon\.ico/', 'type' => 'image/x-icon', 'rel' => 'icon'),
|
||||
array('link' => array('href' => 'preg:/.*favicon\.ico/', 'type' => 'image/x-icon', 'rel' => 'shortcut icon'))
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Html->meta('keywords', 'these, are, some, meta, keywords');
|
||||
$this->assertTags($result, array('meta' => array('name' => 'keywords', 'content' => 'these, are, some, meta, keywords')));
|
||||
|
@ -1197,7 +1197,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
function testTableHeaders() {
|
||||
$result = $this->Html->tableHeaders(array('ID', 'Name', 'Date'));
|
||||
$expected = array('<tr', '<th', 'ID', '/th', '<th', 'Name', '/th', '<th', 'Date', '/th', '/tr');
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1220,7 +1220,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
array('td' => array('width' => 'preg:/100px/')), 'td content 3', '/td',
|
||||
'/tr'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$tr = array('td content 1', 'td content 2', 'td content 3');
|
||||
$result = $this->Html->tableCells($tr, null, null, true);
|
||||
|
@ -1231,7 +1231,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
array('td' => array('class' => 'column-3')), 'td content 3', '/td',
|
||||
'/tr'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$tr = array('td content 1', 'td content 2', 'td content 3');
|
||||
$result = $this->Html->tableCells($tr, true);
|
||||
|
@ -1242,7 +1242,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
array('td' => array('class' => 'column-3')), 'td content 3', '/td',
|
||||
'/tr'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$tr = array(
|
||||
array('td content 1', 'td content 2', 'td content 3'),
|
||||
|
@ -1251,7 +1251,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Html->tableCells($tr, array('class' => 'odd'), array('class' => 'even'));
|
||||
$expected = "<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$tr = array(
|
||||
array('td content 1', 'td content 2', 'td content 3'),
|
||||
|
@ -1261,7 +1261,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Html->tableCells($tr, array('class' => 'odd'), array('class' => 'even'));
|
||||
$expected = "<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$tr = array(
|
||||
array('td content 1', 'td content 2', 'td content 3'),
|
||||
|
@ -1271,7 +1271,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$this->Html->tableCells($tr, array('class' => 'odd'), array('class' => 'even'));
|
||||
$result = $this->Html->tableCells($tr, array('class' => 'odd'), array('class' => 'even'), false, false);
|
||||
$expected = "<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1392,7 +1392,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'formend' => 'finish form'
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$tags = $this->Html->getAttribute('_tags');
|
||||
$this->assertEqual($tags['form'], 'start form');
|
||||
$this->assertEqual($tags['formend'], 'finish form');
|
||||
|
@ -1402,7 +1402,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'minimizedAttributeFormat' => 'format'
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertEqual($this->Html->getAttribute('_minimizedAttributeFormat'), 'format');
|
||||
}
|
||||
|
||||
|
|
|
@ -79,15 +79,15 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
$this->Jquery->get('#myLink');
|
||||
$result = $this->Jquery->event('click', 'doClick', array('wrap' => false));
|
||||
$expected = '$("#myLink").bind("click", doClick);';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->event('click', '$(this).show();', array('stop' => false));
|
||||
$expected = '$("#myLink").bind("click", function (event) {$(this).show();});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->event('click', '$(this).hide();');
|
||||
$expected = '$("#myLink").bind("click", function (event) {$(this).hide();'."\n".'return false;});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,7 +98,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
function testDomReady() {
|
||||
$result = $this->Jquery->domReady('foo.name = "bar";');
|
||||
$expected = '$(document).ready(function () {foo.name = "bar";});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +110,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
$this->Jquery->get('#foo');
|
||||
$result = $this->Jquery->each('$(this).hide();');
|
||||
$expected = '$("#foo").each(function () {$(this).hide();});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,39 +122,39 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
$this->Jquery->get('#foo');
|
||||
$result = $this->Jquery->effect('show');
|
||||
$expected = '$("#foo").show();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->effect('hide');
|
||||
$expected = '$("#foo").hide();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->effect('hide', array('speed' => 'fast'));
|
||||
$expected = '$("#foo").hide("fast");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->effect('fadeIn');
|
||||
$expected = '$("#foo").fadeIn();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->effect('fadeOut');
|
||||
$expected = '$("#foo").fadeOut();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->effect('slideIn');
|
||||
$expected = '$("#foo").slideDown();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->effect('slideOut');
|
||||
$expected = '$("#foo").slideUp();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->effect('slideDown');
|
||||
$expected = '$("#foo").slideDown();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->effect('slideUp');
|
||||
$expected = '$("#foo").slideUp();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,13 +165,13 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
function testRequest() {
|
||||
$result = $this->Jquery->request(array('controller' => 'posts', 'action' => 'view', 1));
|
||||
$expected = '$.ajax({url:"\\/posts\\/view\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->request(array('controller' => 'posts', 'action' => 'view', 1), array(
|
||||
'update' => '#content'
|
||||
));
|
||||
$expected = '$.ajax({dataType:"html", success:function (data, textStatus) {$("#content").html(data);}, url:"\/posts\/view\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -184,7 +184,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$.ajax({beforeSend:doBefore, complete:doComplete, data:"name=jim&height=185cm", dataType:"json", error:handleError, success:doSuccess, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
'update' => '#updated',
|
||||
|
@ -193,7 +193,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$.ajax({dataType:"html", success:function (data, textStatus) {doFoo$("#updated").html(data);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
'update' => '#updated',
|
||||
|
@ -204,7 +204,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$.ajax({data:$("#someId").serialize(), dataType:"html", success:function (data, textStatus) {doFoo$("#updated").html(data);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
'success' => 'doFoo',
|
||||
|
@ -214,7 +214,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'data' => '$("#someId").serialize()',
|
||||
));
|
||||
$expected = '$.ajax({beforeSend:function (XMLHttpRequest) {doBefore}, data:$("#someId").serialize(), success:function (data, textStatus) {doFoo}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -234,7 +234,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$j.ajax({data:$j("#someId").serialize(), dataType:"html", success:function (data, textStatus) {doFoo$j("#updated").html(data);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -253,7 +253,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$("#myList").sortable({containment:"parent", distance:5, sort:onSort, start:onStart, stop:onStop});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->sortable(array(
|
||||
'distance' => 5,
|
||||
|
@ -263,7 +263,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'sort' => 'onSort',
|
||||
));
|
||||
$expected = '$("#myList").sortable({containment:"parent", distance:5, sort:function (event, ui) {onSort}, start:function (event, ui) {onStart}, stop:function (event, ui) {onStop}});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -282,7 +282,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$("#element").draggable({containment:"#content", drag:onDrag, grid:[10,10], start:onStart, stop:onStop});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->drag(array(
|
||||
'container' => '#content',
|
||||
|
@ -292,7 +292,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'snapGrid' => array(10, 10),
|
||||
));
|
||||
$expected = '$("#element").draggable({containment:"#content", drag:function (event, ui) {onDrag}, grid:[10,10], start:function (event, ui) {onStart}, stop:function (event, ui) {onStop}});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -310,7 +310,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$("#element").droppable({accept:".items", drop:onDrop, out:onExit, over:onHover});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->drop(array(
|
||||
'accept' => '.items',
|
||||
|
@ -319,7 +319,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'drop' => 'onDrop',
|
||||
));
|
||||
$expected = '$("#element").droppable({accept:".items", drop:function (event, ui) {onDrop}, out:function (event, ui) {onExit}, over:function (event, ui) {onHover}});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -339,7 +339,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$("#element").slider({change:onChange, max:10, min:0, orientation:"vertical", stop:onComplete, value:2});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->slider(array(
|
||||
'complete' => 'onComplete',
|
||||
|
@ -350,7 +350,7 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
'direction' => 'vertical',
|
||||
));
|
||||
$expected = '$("#element").slider({change:function (event, ui) {onChange}, max:10, min:0, orientation:"vertical", stop:function (event, ui) {onComplete}, value:2});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -362,14 +362,14 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
|||
$this->Jquery->get('#element');
|
||||
$result = $this->Jquery->serializeForm(array('isForm' => false));
|
||||
$expected = '$("#element").closest("form").serialize();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->serializeForm(array('isForm' => true));
|
||||
$expected = '$("#element").serialize();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Jquery->serializeForm(array('isForm' => false, 'inline' => true));
|
||||
$expected = '$("#element").closest("form").serialize()';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
$this->cDataEnd,
|
||||
'/script',
|
||||
);
|
||||
$this->assertTags($result, $expected, true);
|
||||
$this->assertTags($expected, $result, true);
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->atLeastOnce())->method('domReady');
|
||||
$result = $this->Js->writeBuffer(array('onDomReady' => true, 'cache' => false, 'clear' => false));
|
||||
|
@ -326,7 +326,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
'script' => array('type' => 'text/javascript', 'src' => 'preg:/(.)*\.js/'),
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
preg_match('/src="(.*\.js)"/', $result, $filename);
|
||||
$this->assertTrue(file_exists(WWW_ROOT . $filename[1]));
|
||||
$contents = file_get_contents(WWW_ROOT . $filename[1]);
|
||||
|
@ -363,7 +363,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
'test link',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,7 +400,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
'test link »',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -419,7 +419,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
'test link',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -451,7 +451,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
$this->cDataEnd,
|
||||
'/script'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -482,7 +482,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
'-event handler-',
|
||||
'/script'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -521,7 +521,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
'input' => array('type' => 'submit', 'id' => $options['id'], 'value' => 'Save', 'style' => 'margin: 0'),
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -567,7 +567,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
'input' => array('type' => 'submit', 'id' => $options['id'], 'value' => 'Save'),
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -589,11 +589,11 @@ class JsHelperTest extends CakeTestCase {
|
|||
$this->Js->TestJsEngine->expects($this->at(2))
|
||||
->method('request')
|
||||
->will($this->returnValue('ajax-code'));
|
||||
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(3))
|
||||
->method('event')
|
||||
->will($this->returnValue('event-handler'));
|
||||
|
||||
|
||||
$params = array(
|
||||
'update' => $options['update'], 'data' => 'serialize-code',
|
||||
'method' => 'post', 'dataExpression' => true, 'buffer' => false
|
||||
|
@ -612,7 +612,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
'event-handler',
|
||||
'/script'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -623,7 +623,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
function testObjectPassThrough() {
|
||||
$result = $this->Js->object(array('one' => 'first', 'two' => 'second'));
|
||||
$expected = '{"one":"first","two":"second"}';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -635,7 +635,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
function testValuePassThrough() {
|
||||
$result = $this->Js->value('string "quote"', true);
|
||||
$expected = '"string \"quote\""';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -718,27 +718,27 @@ class JsBaseEngineTest extends CakeTestCase {
|
|||
function testEscaping() {
|
||||
$result = $this->JsEngine->escape('');
|
||||
$expected = '';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->JsEngine->escape('CakePHP' . "\n" . 'Rapid Development Framework');
|
||||
$expected = 'CakePHP\\nRapid Development Framework';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->JsEngine->escape('CakePHP' . "\r\n" . 'Rapid Development Framework' . "\r" . 'For PHP');
|
||||
$expected = 'CakePHP\\r\\nRapid Development Framework\\rFor PHP';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->JsEngine->escape('CakePHP: "Rapid Development Framework"');
|
||||
$expected = 'CakePHP: \\"Rapid Development Framework\\"';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->JsEngine->escape("CakePHP: 'Rapid Development Framework'");
|
||||
$expected = "CakePHP: 'Rapid Development Framework'";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->JsEngine->escape('my \\"string\\"');
|
||||
$expected = 'my \\\\\\"string\\\\\\"';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -749,11 +749,11 @@ class JsBaseEngineTest extends CakeTestCase {
|
|||
function testPrompt() {
|
||||
$result = $this->JsEngine->prompt('Hey, hey you', 'hi!');
|
||||
$expected = 'prompt("Hey, hey you", "hi!");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->JsEngine->prompt('"Hey"', '"hi"');
|
||||
$expected = 'prompt("\"Hey\"", "\"hi\"");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -764,11 +764,11 @@ class JsBaseEngineTest extends CakeTestCase {
|
|||
function testAlert() {
|
||||
$result = $this->JsEngine->alert('Hey there');
|
||||
$expected = 'alert("Hey there");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->JsEngine->alert('"Hey"');
|
||||
$expected = 'alert("\"Hey\"");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -779,11 +779,11 @@ class JsBaseEngineTest extends CakeTestCase {
|
|||
function testConfirm() {
|
||||
$result = $this->JsEngine->confirm('Are you sure?');
|
||||
$expected = 'confirm("Are you sure?");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->JsEngine->confirm('"Are you sure?"');
|
||||
$expected = 'confirm("\"Are you sure?\"");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -794,7 +794,7 @@ class JsBaseEngineTest extends CakeTestCase {
|
|||
function testRedirect() {
|
||||
$result = $this->JsEngine->redirect(array('controller' => 'posts', 'action' => 'view', 1));
|
||||
$expected = 'window.location = "/posts/view/1";';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -807,17 +807,17 @@ class JsBaseEngineTest extends CakeTestCase {
|
|||
$object = array('title' => 'New thing', 'indexes' => array(5, 6, 7, 8));
|
||||
$result = $this->JsEngine->object($object);
|
||||
$expected = '{"title":"New thing","indexes":[5,6,7,8]}';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$object = new JsEncodingObject();
|
||||
$object->title = 'New thing';
|
||||
$object->indexes = array(5,6,7,8);
|
||||
$result = $this->JsEngine->object($object);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->JsEngine->object(array('default' => 0));
|
||||
$expected = '{"default":0}';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->JsEngine->object(array(
|
||||
'2007' => array(
|
||||
|
@ -838,11 +838,11 @@ class JsBaseEngineTest extends CakeTestCase {
|
|||
)
|
||||
));
|
||||
$expected = '{"2007":{"Spring":{"1":{"id":1,"name":"Josh"},"2":{"id":2,"name":"Becky"}},"Fall":{"1":{"id":1,"name":"Josh"},"2":{"id":2,"name":"Becky"}}},"2006":{"Spring":{"1":{"id":1,"name":"Josh"},"2":{"id":2,"name":"Becky"}},"Fall":{"1":{"id":1,"name":"Josh"},"2":{"id":2,"name":"Becky"}}}}';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
foreach (array('true' => true, 'false' => false, 'null' => null) as $expected => $data) {
|
||||
$result = $this->JsEngine->object($data);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
$object = array('title' => 'New thing', 'indexes' => array(5, 6, 7, 8), 'object' => array('inner' => array('value' => 1)));
|
||||
|
@ -883,11 +883,11 @@ class JsBaseEngineTest extends CakeTestCase {
|
|||
|
||||
$result = $JsEngine->testParseOptions(array('url' => '/posts/view/1', 'key' => 1));
|
||||
$expected = 'key:1, url:"\\/posts\\/view\\/1"';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $JsEngine->testParseOptions(array('url' => '/posts/view/1', 'success' => 'doSuccess'), array('success'));
|
||||
$expected = 'success:doSuccess, url:"\\/posts\\/view\\/1"';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,15 +88,15 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
$this->Moo->get('#myLink');
|
||||
$result = $this->Moo->event('click', 'doClick', array('wrap' => false));
|
||||
$expected = '$("myLink").addEvent("click", doClick);';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->event('click', 'this.setStyle("display", "");', array('stop' => false));
|
||||
$expected = '$("myLink").addEvent("click", function (event) {this.setStyle("display", "");});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->event('click', 'this.setStyle("display", "none");');
|
||||
$expected = "\$(\"myLink\").addEvent(\"click\", function (event) {event.stop();\nthis.setStyle(\"display\", \"none\");});";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* test dom ready event creation
|
||||
|
@ -106,7 +106,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
function testDomReady() {
|
||||
$result = $this->Moo->domReady('foo.name = "bar";');
|
||||
$expected = 'window.addEvent("domready", function (event) {foo.name = "bar";});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* test Each method
|
||||
|
@ -117,7 +117,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
$this->Moo->get('#foo');
|
||||
$result = $this->Moo->each('item.setStyle("display", "none");');
|
||||
$expected = '$("foo").each(function (item, index) {item.setStyle("display", "none");});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* test Effect generation
|
||||
|
@ -128,35 +128,35 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
$this->Moo->get('#foo');
|
||||
$result = $this->Moo->effect('show');
|
||||
$expected = '$("foo").setStyle("display", "");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->effect('hide');
|
||||
$expected = '$("foo").setStyle("display", "none");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->effect('fadeIn');
|
||||
$expected = '$("foo").fade("in");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->effect('fadeOut');
|
||||
$expected = '$("foo").fade("out");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->effect('slideIn');
|
||||
$expected = '$("foo").slide("in");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->effect('slideOut');
|
||||
$expected = '$("foo").slide("out");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->effect('slideOut', array('speed' => 'fast'));
|
||||
$expected = '$("foo").set("slide", {duration:"short"}).slide("out");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->effect('slideOut', array('speed' => 'slow'));
|
||||
$expected = '$("foo").set("slide", {duration:"long"}).slide("out");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* Test Request Generation
|
||||
|
@ -166,11 +166,11 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
function testRequest() {
|
||||
$result = $this->Moo->request(array('controller' => 'posts', 'action' => 'view', 1));
|
||||
$expected = 'var jsRequest = new Request({url:"\\/posts\\/view\\/1"}).send();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->request('/posts/view/1', array('update' => 'content'));
|
||||
$expected = 'var jsRequest = new Request.HTML({update:"content", url:"\\/posts\\/view\\/1"}).send();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -181,7 +181,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsRequest = new Request.JSON({method:"post", onComplete:doSuccess, onFailure:handleError, url:"\\/people\\/edit\\/1"}).send({"name":"jim","height":"185cm"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -190,7 +190,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsRequest = new Request.HTML({method:"post", onComplete:doSuccess, update:"update-zone", url:"\\/people\\/edit\\/1"}).send();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -202,7 +202,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsRequest = new Request.HTML({method:"post", onComplete:doComplete, onFailure:doFailure, onRequest:doBefore, onSuccess:doSuccess, update:"update-zone", url:"\\/people\\/edit\\/1"}).send();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -216,7 +216,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsRequest = new Request.HTML({method:"post", onComplete:doComplete, onFailure:doFailure, onRequest:doBefore, onSuccess:doSuccess, update:"update-zone", url:"\\/people\\/edit\\/1"}).send($("foo").toQueryString());';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -226,7 +226,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'update' => '#update-zone',
|
||||
));
|
||||
$expected = 'var jsRequest = new Request.HTML({method:"post", onComplete:function () {doComplete}, onRequest:function () {doBefore}, onSuccess:function (responseText, responseXML) {doSuccess}, update:"update-zone", url:"\\/people\\/edit\\/1"}).send();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* test sortable list generation
|
||||
|
@ -244,7 +244,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsSortable = new Sortables($("myList"), {constrain:"parent", onComplete:onStop, onSort:onSort, onStart:onStart, snap:5});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* test drag() method
|
||||
|
@ -261,7 +261,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$("drag-me").makeDraggable({onComplete:onStop, onDrag:onDrag, onStart:onStart, snap:[10,10]});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* test drop() method
|
||||
|
@ -285,7 +285,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$("my-drag").makeDraggable({droppables:$("drop-me"), onDrop:onDrop, onEnter:onHover, onLeave:onLeave});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertEqual($this->Moo->selection, '$("drop-me")');
|
||||
|
||||
$result = $this->Moo->drop(array(
|
||||
|
@ -295,7 +295,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'drag' => '#my-drag',
|
||||
));
|
||||
$expected = '$("my-drag").makeDraggable({droppables:$("drop-me"), onDrop:function (element, droppable, event) {onDrop}, onEnter:function (element, droppable) {onHover}, onLeave:function (element, droppable) {onLeave}});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* test slider generation
|
||||
|
@ -312,7 +312,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsSlider = new Slider($("slider"), $("my-handle"), {mode:"horizontal", onChange:onChange, onComplete:onComplete});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertEqual($this->Moo->selection, '$("slider")');
|
||||
|
||||
$this->Moo->get('#slider');
|
||||
|
@ -326,7 +326,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsSlider = new Slider($("slider"), $("my-handle"), {mode:"horizontal", onChange:onChange, onComplete:onComplete, range:[10,40]});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Moo->get('#slider');
|
||||
$result = $this->Moo->slider(array(
|
||||
|
@ -336,7 +336,7 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
'direction' => 'horizontal',
|
||||
));
|
||||
$expected = 'var jsSlider = new Slider($("slider"), $("my-handle"), {mode:"horizontal", onChange:function (step) {change;}, onComplete:function (event) {complete;}});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* test the serializeForm implementation.
|
||||
|
@ -347,18 +347,18 @@ class MooEngineHelperTest extends CakeTestCase {
|
|||
$this->Moo->get('#element');
|
||||
$result = $this->Moo->serializeForm(array('isForm' => true));
|
||||
$expected = '$("element").toQueryString();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->serializeForm(array('isForm' => true, 'inline' => true));
|
||||
$expected = '$("element").toQueryString()';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->serializeForm(array('isForm' => false));
|
||||
$expected = '$($("element").form).toQueryString();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Moo->serializeForm(array('isForm' => false, 'inline' => true));
|
||||
$expected = '$($("element").form).toQueryString()';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,39 +133,39 @@ class NumberHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Number->currency(1, null, array('wholeSymbol' => '$ '));
|
||||
$expected = '$ 1.00';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(1, null, array('wholeSymbol' => ' $', 'wholePosition' => 'after'));
|
||||
$expected = '1.00 $';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(.2, null, array('wholeSymbol' => ' $', 'wholePosition' => 'after', 'fractionSymbol' => 'cents'));
|
||||
$expected = '20cents';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(.2, null, array('wholeSymbol' => ' $', 'wholePosition' => 'after', 'fractionSymbol' => 'cents', 'fractionPosition' => 'before'));
|
||||
$expected = 'cents20';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(311, 'USD', array('wholePosition' => 'after'));
|
||||
$expected = '311.00$';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(.2, 'EUR');
|
||||
$expected = '€0,20';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(12, null, array('wholeSymbol' => ' dollars', 'wholePosition' => 'after', 'fractionSymbol' => ' cents', 'fractionPosition' => 'after'));
|
||||
$expected = '12.00 dollars';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(.12, null, array('wholeSymbol' => ' dollars', 'wholePosition' => 'after', 'fractionSymbol' => ' cents', 'fractionPosition' => 'after'));
|
||||
$expected = '12 cents';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(.5, null, array('fractionSymbol' => false, 'fractionPosition' => 'before', 'wholeSymbol' => '$'));
|
||||
$expected = '$0.50';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -381,7 +381,7 @@ class NumberHelperTest extends CakeTestCase {
|
|||
$result = $this->Number->currency('0.35', 'GBP');
|
||||
$expected = '35p';
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
|
||||
$result = $this->Number->currency('0.35', 'EUR');
|
||||
$expected = '€0,35';
|
||||
$this->assertEqual($expected, $result);
|
||||
|
@ -460,18 +460,18 @@ class NumberHelperTest extends CakeTestCase {
|
|||
function testToPercentage() {
|
||||
$result = $this->Number->toPercentage(45, 0);
|
||||
$expected = '45%';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->toPercentage(45, 2);
|
||||
$expected = '45.00%';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->toPercentage(0, 0);
|
||||
$expected = '0%';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->toPercentage(0, 4);
|
||||
$expected = '0.0000%';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -87,15 +87,15 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
$this->Proto->get('#myLink');
|
||||
$result = $this->Proto->event('click', 'doClick', array('wrap' => false));
|
||||
$expected = '$("myLink").observe("click", doClick);';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->event('click', 'Element.hide(this);', array('stop' => false));
|
||||
$expected = '$("myLink").observe("click", function (event) {Element.hide(this);});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->event('click', 'Element.hide(this);');
|
||||
$expected = "\$(\"myLink\").observe(\"click\", function (event) {event.stop();\nElement.hide(this);});";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,7 +106,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
function testDomReady() {
|
||||
$result = $this->Proto->domReady('foo.name = "bar";');
|
||||
$expected = 'document.observe("dom:loaded", function (event) {foo.name = "bar";});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,7 +118,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
$this->Proto->get('#foo li');
|
||||
$result = $this->Proto->each('item.hide();');
|
||||
$expected = '$$("#foo li").each(function (item, index) {item.hide();});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,51 +130,51 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
$this->Proto->get('#foo');
|
||||
$result = $this->Proto->effect('show');
|
||||
$expected = '$("foo").show();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('hide');
|
||||
$expected = '$("foo").hide();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('fadeIn');
|
||||
$expected = '$("foo").appear();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('fadeIn', array('speed' => 'fast'));
|
||||
$expected = '$("foo").appear({duration:0.50000000000});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('fadeIn', array('speed' => 'slow'));
|
||||
$expected = '$("foo").appear({duration:2});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('fadeOut');
|
||||
$expected = '$("foo").fade();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('fadeOut', array('speed' => 'fast'));
|
||||
$expected = '$("foo").fade({duration:0.50000000000});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('fadeOut', array('speed' => 'slow'));
|
||||
$expected = '$("foo").fade({duration:2});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('slideIn');
|
||||
$expected = 'Effect.slideDown($("foo"));';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('slideOut');
|
||||
$expected = 'Effect.slideUp($("foo"));';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('slideOut', array('speed' => 'fast'));
|
||||
$expected = 'Effect.slideUp($("foo"), {duration:0.50000000000});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->effect('slideOut', array('speed' => 'slow'));
|
||||
$expected = 'Effect.slideUp($("foo"), {duration:2});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,7 +185,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
function testRequest() {
|
||||
$result = $this->Proto->request(array('controller' => 'posts', 'action' => 'view', 1));
|
||||
$expected = 'var jsRequest = new Ajax.Request("/posts/view/1");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->request('/posts/view/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -197,11 +197,11 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsRequest = new Ajax.Request("/posts/view/1", {method:"post", onComplete:doComplete, onCreate:doBefore, onFailure:doError, onSuccess:doSuccess, parameters:{"name":"jim","height":"185cm"}});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->request('/posts/view/1', array('update' => 'content'));
|
||||
$expected = 'var jsRequest = new Ajax.Updater("content", "/posts/view/1");';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -210,7 +210,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsRequest = new Ajax.Updater("update-zone", "/people/edit/1", {method:"post", onComplete:doSuccess});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -221,7 +221,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsRequest = new Ajax.Request("/people/edit/1", {method:"post", onComplete:doSuccess, onFailure:handleError, parameters:{"name":"jim","height":"185cm"}});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -233,7 +233,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsRequest = new Ajax.Request("/people/edit/1", {method:"post", onComplete:doSuccess, onFailure:handleError, parameters:$("element").serialize()});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
|
@ -243,7 +243,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'error' => 'handleError();',
|
||||
));
|
||||
$expected = 'var jsRequest = new Ajax.Request("/people/edit/1", {method:"post", onComplete:function (transport) {doComplete();}, onCreate:function (transport) {doBefore();}, onFailure:function (response, jsonHeader) {handleError();}, onSuccess:function (response, jsonHeader) {doSuccess();}});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->request('/people/edit/1', array(
|
||||
'async' => false,
|
||||
|
@ -254,7 +254,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'error' => 'handleError();',
|
||||
));
|
||||
$expected = 'var jsRequest = new Ajax.Request("/people/edit/1", {asynchronous:false, method:"post", onComplete:function (transport) {doComplete();}, onCreate:function (transport) {doBefore();}, onFailure:function (response, jsonHeader) {handleError();}, onSuccess:function (response, jsonHeader) {doSuccess();}});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Proto->get('#submit');
|
||||
$result = $this->Proto->request('/users/login', array(
|
||||
|
@ -281,7 +281,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsSortable = Sortable.create($("myList"), {onChange:onSort, onUpdate:onComplete});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -300,7 +300,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsDrag = new Draggable($("element"), {onDrag:onDrag, onEnd:onStop, onStart:onStart, snap:[10,10]});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Proto->get('div.dragger');
|
||||
$result = $this->Proto->drag(array(
|
||||
|
@ -311,7 +311,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$$("div.dragger").each(function (item, index) {new Draggable(item, {onDrag:onDrag, onEnd:onStop, onStart:onStart, snap:[10,10]});});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -328,7 +328,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'Droppables.add($("element"), {accept:".drag-me", onDrop:onDrop, onHover:onHover});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -347,7 +347,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = 'var jsSlider = new Control.Slider($("handle"), $("element"), {axis:"horizontal", onChange:onComplete, onSlide:onChange, sliderValue:4});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Proto->get('#element');
|
||||
$result = $this->Proto->slider(array(
|
||||
|
@ -359,7 +359,7 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
'max' => 100
|
||||
));
|
||||
$expected = 'var jsSlider = new Control.Slider($("handle"), $("element"), {onChange:function (value) {complete();}, onSlide:function (value) {change();}, range:$R(10,100), sliderValue:4});';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -371,18 +371,18 @@ class PrototypeEngineHelperTest extends CakeTestCase {
|
|||
$this->Proto->get('#element');
|
||||
$result = $this->Proto->serializeForm(array('isForm' => true));
|
||||
$expected = '$("element").serialize();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->serializeForm(array('isForm' => true, 'inline' => true));
|
||||
$expected = '$("element").serialize()';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->serializeForm(array('isForm' => false));
|
||||
$expected = '$($("element").form).serialize();';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Proto->serializeForm(array('isForm' => false, 'inline' => true));
|
||||
$expected = '$($("element").form).serialize()';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'version' => '2.0'
|
||||
)
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Rss->document(null, 'content');
|
||||
$expected = array(
|
||||
|
@ -73,7 +73,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
),
|
||||
'content'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Rss->document(array('contrived' => 'parameter'), 'content');
|
||||
$expected = array(
|
||||
|
@ -83,7 +83,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
),
|
||||
'content'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,7 +113,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'content',
|
||||
'/channel'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -163,7 +163,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'content-here',
|
||||
'/channel',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
function testChannelElementAttributes() {
|
||||
|
@ -205,7 +205,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'content-here',
|
||||
'/channel',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -242,11 +242,11 @@ class RssHelperTest extends CakeTestCase {
|
|||
'<description', 'description3', '/description',
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$result = $this->Rss->items(array());
|
||||
$expected = '';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -278,7 +278,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'/guid',
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$item = array(
|
||||
'title' => 'My Title',
|
||||
|
@ -308,7 +308,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'/guid',
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$item = array(
|
||||
'title' => 'My Title & more'
|
||||
|
@ -319,7 +319,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'<title', 'My Title & more', '/title',
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$item = array(
|
||||
'title' => 'Foo bar',
|
||||
|
@ -353,7 +353,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'/guid',
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -377,7 +377,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'/title',
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$item = array(
|
||||
'category' => array(
|
||||
|
@ -394,7 +394,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'/category',
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$item = array(
|
||||
'category' => array(
|
||||
|
@ -420,7 +420,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'/category',
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
|
||||
$item = array(
|
||||
'title' => array(
|
||||
|
@ -476,7 +476,7 @@ class RssHelperTest extends CakeTestCase {
|
|||
'/category',
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -514,6 +514,6 @@ class RssHelperTest extends CakeTestCase {
|
|||
),
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,12 +124,12 @@ class SessionHelperTest extends CakeTestCase {
|
|||
function testFlash() {
|
||||
$result = $this->Session->flash('flash');
|
||||
$expected = '<div id="flashMessage" class="message">This is a calling</div>';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertFalse($this->Session->check('Message.flash'));
|
||||
|
||||
$expected = '<div id="classyMessage" class="positive">Recorded</div>';
|
||||
$result = $this->Session->flash('classy');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
App::build(array(
|
||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
||||
|
@ -137,12 +137,12 @@ class SessionHelperTest extends CakeTestCase {
|
|||
$result = $this->Session->flash('notification');
|
||||
$result = str_replace("\r\n", "\n", $result);
|
||||
$expected = "<div id=\"notificationLayout\">\n\t<h1>Alert!</h1>\n\t<h3>Notice!</h3>\n\t<p>This is a test of the emergency broadcasting system</p>\n</div>";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertFalse($this->Session->check('Message.notification'));
|
||||
|
||||
$result = $this->Session->flash('bare');
|
||||
$expected = 'Bare message';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertFalse($this->Session->check('Message.bare'));
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ class SessionHelperTest extends CakeTestCase {
|
|||
function testFlashAttributes() {
|
||||
$result = $this->Session->flash('flash', array('params' => array('class' => 'test-message')));
|
||||
$expected = '<div id="flashMessage" class="test-message">This is a calling</div>';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertFalse($this->Session->check('Message.flash'));
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ class TextHelperTest extends CakeTestCase {
|
|||
$expected = 'Ich <b>saß</b> in einem <b>Café</b> am <b>Übergang</b>';
|
||||
$phrases = array('saß', 'café', 'übergang');
|
||||
$result = $this->Text->highlight($text, $phrases, array('format' => '<b>\1</b>'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -205,32 +205,32 @@ class TextHelperTest extends CakeTestCase {
|
|||
$text = 'This is a test text with URL http://www.cakephp.org';
|
||||
$expected = 'This is a test text with URL <a href="http://www.cakephp.org">http://www.cakephp.org</a>';
|
||||
$result = $this->Text->autoLink($text);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$text = 'This is a test text with URL http://www.cakephp.org and some more text';
|
||||
$expected = 'This is a test text with URL <a href="http://www.cakephp.org">http://www.cakephp.org</a> and some more text';
|
||||
$result = $this->Text->autoLink($text);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$text = "This is a test text with URL http://www.cakephp.org\tand some more text";
|
||||
$expected = "This is a test text with URL <a href=\"http://www.cakephp.org\">http://www.cakephp.org</a>\tand some more text";
|
||||
$result = $this->Text->autoLink($text);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$text = 'This is a test text with URL http://www.cakephp.org(and some more text)';
|
||||
$expected = 'This is a test text with URL <a href="http://www.cakephp.org">http://www.cakephp.org</a>(and some more text)';
|
||||
$result = $this->Text->autoLink($text);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$text = 'This is a test text with URL http://www.cakephp.org';
|
||||
$expected = 'This is a test text with URL <a href="http://www.cakephp.org" class="link">http://www.cakephp.org</a>';
|
||||
$result = $this->Text->autoLink($text, array('class'=>'link'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$text = 'This is a test text with URL http://www.cakephp.org';
|
||||
$expected = 'This is a test text with URL <a href="http://www.cakephp.org" class="link" id="MyLink">http://www.cakephp.org</a>';
|
||||
$result = $this->Text->autoLink($text, array('class'=>'link', 'id'=>'MyLink'));
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -274,12 +274,12 @@ class TextHelperTest extends CakeTestCase {
|
|||
$expected = 'Text with a url <a href="http://www.cot.ag/cuIb2Q">www.cot.ag/cuIb2Q</a> and more';
|
||||
$result = $this->Text->autoLinkUrls($text);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
|
||||
$text = 'Text with a url http://www.does--not--work.com and more';
|
||||
$expected = 'Text with a url <a href="http://www.does--not--work.com">http://www.does--not--work.com</a> and more';
|
||||
$result = $this->Text->autoLinkUrls($text);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
|
||||
$text = 'Text with a url http://www.not--work.com and more';
|
||||
$expected = 'Text with a url <a href="http://www.not--work.com">http://www.not--work.com</a> and more';
|
||||
$result = $this->Text->autoLinkUrls($text);
|
||||
|
@ -302,7 +302,7 @@ class TextHelperTest extends CakeTestCase {
|
|||
$expected = 'Text with <a href="mailto:email@example.com"\s*>email@example.com</a> address';
|
||||
$result = $this->Text->autoLinkEmails($text);
|
||||
$this->assertPattern('#^' . $expected . '$#', $result);
|
||||
|
||||
|
||||
$text = "Text with o'hare._-bob@example.com address";
|
||||
$expected = 'Text with <a href="mailto:o'hare._-bob@example.com">o'hare._-bob@example.com</a> address';
|
||||
$result = $this->Text->autoLinkEmails($text);
|
||||
|
@ -427,7 +427,7 @@ class TextHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Text->toList(array( 'name1' => 'Dusty', 'name2' => 'Lucky'));
|
||||
$this->assertEqual($result, 'Dusty and Lucky');
|
||||
|
||||
|
||||
$result = $this->Text->toList(array( 'test_0' => 'banana', 'test_1' => 'apple', 'test_2' => 'lemon'));
|
||||
$this->assertEqual($result, 'banana, apple and lemon');
|
||||
}
|
||||
|
|
|
@ -622,7 +622,7 @@ class TimeHelperTest extends CakeTestCase {
|
|||
|
||||
$expected = time();
|
||||
$result = $this->Time->fromString(time(), $yourTimezone);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -640,12 +640,12 @@ class TimeHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Time->fromString('+1 hour');
|
||||
$expected = strtotime('+1 hour');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$timezone = date('Z', time());
|
||||
$result = $this->Time->fromString('+1 hour', $timezone);
|
||||
$expected = $this->Time->convert(strtotime('+1 hour'), $timezone);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -663,79 +663,79 @@ class TimeHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Time->convertSpecifiers('%a', $time);
|
||||
$expected = 'jue';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%A', $time);
|
||||
$expected = 'jueves';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%c', $time);
|
||||
$expected = 'jue %d ene %Y %H:%M:%S %Z';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%C', $time);
|
||||
$expected = '20';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%D', $time);
|
||||
$expected = '%m/%d/%y';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%b', $time);
|
||||
$expected = 'ene';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%h', $time);
|
||||
$expected = 'ene';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%B', $time);
|
||||
$expected = 'enero';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%n', $time);
|
||||
$expected = "\n";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%n', $time);
|
||||
$expected = "\n";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%p', $time);
|
||||
$expected = 'AM';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%P', $time);
|
||||
$expected = 'am';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%r', $time);
|
||||
$expected = '%I:%M:%S AM';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%R', $time);
|
||||
$expected = '11:43';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%t', $time);
|
||||
$expected = "\t";
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%T', $time);
|
||||
$expected = '%H:%M:%S';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%u', $time);
|
||||
$expected = 4;
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%x', $time);
|
||||
$expected = '%d/%m/%y';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%X', $time);
|
||||
$expected = '%H:%M:%S';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -750,11 +750,11 @@ class TimeHelperTest extends CakeTestCase {
|
|||
$time = strtotime('Thu Jan 14 11:43:39 2010');
|
||||
$result = $this->Time->convertSpecifiers('%e', $time);
|
||||
$expected = '14';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->convertSpecifiers('%e', strtotime('2011-01-01'));
|
||||
$expected = ' 1';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -772,19 +772,19 @@ class TimeHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Time->i18nFormat($time);
|
||||
$expected = '14/01/10';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->i18nFormat($time, '%c');
|
||||
$expected = 'jue 14 ene 2010 13:59:28 ' . strftime('%Z', $time);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->i18nFormat($time, 'Time is %r, and date is %x');
|
||||
$expected = 'Time is 01:59:28 PM, and date is 14/01/10';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Time->i18nFormat('invalid date', '%x', 'Date invalid');
|
||||
$expected = 'Date invalid';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -648,7 +648,7 @@ class HelperTest extends CakeTestCase {
|
|||
}
|
||||
}
|
||||
$expected = array('what', 'how', 'how', 'what', 'how', 'how');
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Helper->request->data['HelperTestComment']['5']['id'] = 'ok';
|
||||
$result = $this->Helper->value('HelperTestComment.5.id');
|
||||
|
@ -754,7 +754,7 @@ class HelperTest extends CakeTestCase {
|
|||
$this->Helper->request->webroot = '/';
|
||||
$result = $this->Helper->webroot('/img/cake.power.gif');
|
||||
$expected = '/img/cake.power.gif';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$this->Helper->theme = 'test_theme';
|
||||
|
||||
|
@ -764,30 +764,30 @@ class HelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Helper->webroot('/img/cake.power.gif');
|
||||
$expected = '/theme/test_theme/img/cake.power.gif';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Helper->webroot('/img/test.jpg');
|
||||
$expected = '/theme/test_theme/img/test.jpg';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$webRoot = Configure::read('App.www_root');
|
||||
Configure::write('App.www_root', CAKE . 'Test' . DS . 'test_app' . DS . 'webroot' . DS);
|
||||
|
||||
$result = $this->Helper->webroot('/img/cake.power.gif');
|
||||
$expected = '/theme/test_theme/img/cake.power.gif';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Helper->webroot('/img/test.jpg');
|
||||
$expected = '/theme/test_theme/img/test.jpg';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Helper->webroot('/img/cake.icon.gif');
|
||||
$expected = '/img/cake.icon.gif';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Helper->webroot('/img/cake.icon.gif?some=param');
|
||||
$expected = '/img/cake.icon.gif?some=param';
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
Configure::write('App.www_root', $webRoot);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue