OS X 10.6.7
MAMP 1.9.6
Apache/2.0.64 (Unix) PHP/5.3.5 DAV/2 Yii Framework/1.1.7 2011-04-25
I’m new to php, yii, mysql.
I’m working my way through the yii book by Jeffrey Winesett.
I have a phpunit test that succeeds but gii fails.
I can login to gii. I can see the 5 bullet menu. Controller Generator, Form Generator, Module Generator menu choices yield another html page but…
Crud Generator and Model Generator produce this error:
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2003] Can’t connect to MySQL server on ‘localhost:8889’ (4)
Specifically at line 52 in
/Applications/MAMP/htdocs/yii/framework/gii/generators/model/ModelCode.php(52)
and it looks like this:
if(Yii::app()->db===null)
<minor query> not sure why there are 3 equal signs in the code above.</minor query>
my phpunit test that succeeds:
<?php
class DbTest extends CTestCase
{
public function testConnection()
{
// is the db connection alive?
$this->assertNotEquals(NULL, Yii::app()->db);
$this->assertNotEquals(false, Yii::app()->db->active);
// now for table name analysis
$ar = Yii::app()->db->getSchema()->getTableNames();
$this->assertNotEquals(NULL, $ar);
$this->assertEquals( 'tbl_project', $ar[0]); }
}
any assistance would be gratefully received. Please be explicit about file locations and versions. TIA.