Check out the extra quotes in the model name in the WHERE clause below: SELECT `Organization`.`name`, `Organization`.`description` FROM `organizations` AS `Organization` WHERE `‘Organization’`.`status` = 'inactive' ORDER BY `Organization`.`name` asc
I've used SimpleTest before, but am now beginning to use it in the context of CakePHP's testing framework. All test cases that involving a model are failing because the model names are getting enclosed with single quotes, which produces table names in database queries that of course don't exist. For example: App::import('Model', 'Organization'); class OrganizationTestCase extends CakeTestCase { public $useTable = 'organizations'; public $fixtures = array('app.organization'); public function testInactive() { $this->Organization = ClassRegistry::init('Organization'); $result = $this->Organization->inactive(array('name', 'description')); $expected = array( array('Organization' => array('name' => 'Test Company Name', 'description' => 'Mortgages')) ); $this->assertEqual($result, $expected); } } results in a failed assertion and two E_NOTICES. The failed assertion: Equal expectation fails as [Boolean: false] does not match [Array: 1 items] at [/usr/local/apache2/vhosts/dev-obfuscated.com/app/tests/ cases/models/organization.test.php line 19] The Errors: Unexpected PHP error [Use of undefined constant â��Organizationâ�� - assumed 'â��Organizationâ��'] severity [E_NOTICE] in [/usr/local/ apache2/vhosts/dev-obfuscated.com/cake/libs/class_registry.php line 134] Unexpected PHP error [<span style = "color:Red;text-align:left"><b>SQL Error:</b> 1054: Unknown column 'ââ�¬Ë�Organizationââ�¬â�¢.status' in 'where clause'</span>] severity [E_USER_WARNING] in [/usr/local/ apache2/vhosts/dev-obfuscated.com/cake/libs/model/datasources/ dbo_source.php line 514] The use (or lack of) $useTable in the app/models or tests/cases/models code makes little difference. If I leave out the $useTable statement, the inflector creates this table name: 'organization's generating this message: Error: Database table ‘organization’s for model Organization was not found. What obvious thing am I missing here? Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---