Added test demonstrating useless error messages being thrown for table-less models

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6480 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
the_undefined 2008-02-28 00:23:28 +00:00
parent d3e2d51cbc
commit 8b8b268c08

View file

@ -190,6 +190,12 @@ class ValidateItem extends CakeTestModel {
return false;
}
}
class TestMail extends CakeTestModel {
var $primaryKey = 'id';
var $useTable = false;
var $name = 'TestMail';
}
/**
* Short description for class.
*
@ -1560,6 +1566,18 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->input('MyOther.id');
$this->assertEqual($result, '<input type="hidden" name="data[MyOther][id]" value="" id="MyOtherId" />');
}
function testDbLessModel() {
$this->Form->create('TestMail');
$result = $this->Form->input('name');
$this->assertEqual($result, '<div class="input"><label for="TestMailName">Name</label><input name="data[TestMail][name]" type="text" value="" id="TestMailName" /></div>');
ClassRegistry::init('TestMail');
$this->Form->create('TestMail');
$result = $this->Form->input('name');
$this->assertEqual($result, '<div class="input"><label for="TestMailName">Name</label><input name="data[TestMail][name]" type="text" value="" id="TestMailName" /></div>');
}
function tearDown() {
ClassRegistry::removeObject('view');