I’m using MAMP and have configured PHPUnit + Selenium successfully.
I have two unit tests – one of them works and indicates no errors, the other just returns back to a blank Terminal prompt (no success/failure indication).
Working:
DbTest.php
<?php
class DbTest extends CTestCase
{
public function testConnection()
{
$this->assertNotEquals(NULL, Yii::app()->db);
}
}
Not Working:
ProjectTest.php
<?php
class ProjectTest extends CDbTestCase
{
public function testCRUD()
{
//Create a new project
$newProject= new Project;
$newProjectName = 'Test Project 1';
$newProject->setAttributes(
array(
'name' => $newProjectName,
'description' => 'Test project numero uno',
'create_time' => '2011-05-20 00:00:00',
'create_user_id' => 1,
'update_time' => '2011-05-20 00:00:00',
'update_user_id' => 1,
)
);
$this->assertTrue($newProject->save(false));
//Read a project
$retrievedProject = Project::model()->findByPk($newProject->id);
$this->assertTrue($retrievedProject instanceof Project);
$this->assertEquals($newProjectName, $retrievedProject->name);
}
}
If I run phpunit unit/Dbtest.php, I get:
PHPUnit 3.5.13 by Sebastian Bergmann.
.
Time: 0 seconds, Memory: 4.50Mb
But, if I run phpunit unit/ProjectTest.php, I get a blank prompt:
Trenton-Scotts-MacBook-Air:tests TTS$
Using MySQL, DB connection works (I successfully modeled a table using Gii). Any idea on what could be causing this?