Hi Clark, Looks to me like the thing you are missing is the small problem your source-file has with its quotes.
Use of undefined constant â Organizationâ This suggests that your modelname is not in fact enclosed by single quotes but some other glyph that looks like it but really has another ASCII code. You may have pasted the line of code from a browser or (god forbid) Word and got the strange character in your file that way. If the quotes are not "real" quotes then PHP will interpret this as you trying to use a constant. While you are at it make sure the charset of the php file is not something strange. /Martin On Jan 16, 12:35 am, clarkphp <[email protected]> wrote: > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
