mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding Tests to cover 'in' when doing finds, and making multi record forms with loops.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7468 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
3fb44e4485
commit
5874916ccb
3 changed files with 20 additions and 1 deletions
|
@ -2299,6 +2299,9 @@ class DboSourceTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testArrayConditionsParsing() {
|
||||
$result = $this->testDb->conditions(array('Stereo.type' => 'in dash speakers'));
|
||||
$this->assertPattern("/^\s+WHERE\s+`Stereo`.`type`\s+=\s+'in dash speakers'/", $result);
|
||||
|
||||
$result = $this->testDb->conditions(array('Candy.name LIKE' => 'a', 'HardCandy.name LIKE' => 'c'));
|
||||
$this->assertPattern("/^\s+WHERE\s+`Candy`.`name` LIKE\s+'a'\s+AND\s+`HardCandy`.`name`\s+LIKE\s+'c'/", $result);
|
||||
|
||||
|
|
|
@ -4761,11 +4761,13 @@ class ModelTest extends CakeTestCase {
|
|||
$this->loadFixtures('DataTest');
|
||||
$TestModel =& new DataTest();
|
||||
|
||||
$TestModel->create(array()) && $TestModel->save();
|
||||
$TestModel->create(array());
|
||||
$TestModel->save();
|
||||
$result = $TestModel->findById($TestModel->id);
|
||||
$this->assertIdentical($result['DataTest']['count'], '0');
|
||||
$this->assertIdentical($result['DataTest']['float'], '0');
|
||||
}
|
||||
|
||||
/**
|
||||
* testNonNumericHabtmJoinKey method
|
||||
*
|
||||
|
|
|
@ -1399,6 +1399,20 @@ class FormHelperTest extends CakeTestCase {
|
|||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
for ($i = 1; $i < 5; $i++) {
|
||||
$result = $this->Form->input("Contact.{$i}.email", array('type' => 'checkbox', 'value' => $i));
|
||||
$expected = array(
|
||||
'div' => array('class' => 'input checkbox'),
|
||||
'input' => array('type' => 'hidden', 'name' => "data[Contact][{$i}][email]", 'value' => '0', 'id' => "Contact{$i}Email_"),
|
||||
array('input' => array('type' => 'checkbox', 'name' => "data[Contact][{$i}][email]", 'value' => $i, 'id' => "Contact{$i}Email")),
|
||||
'label' => array('for' => "Contact{$i}Email"),
|
||||
'Email',
|
||||
'/label',
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* testFormInputs method
|
||||
|
|
Loading…
Add table
Reference in a new issue