PHPUnit Tests Don't Return Anything (Prompt)

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?

The possible reason is that unit test generates an exception and PHP is configured for production (do not show an exception and just die). Try to check error_reporting and related options in the php.ini (not it can be separate php.ini used for apache and for console).

Other way to check what is going on is to debug test case and see what line causes script termination.

This is your problem:

$newProject= new Project;

you may create new wrong project name. What did you type as you try on Gii first time? And what is the filename.php? That filename is your project name, such as TblProject.php. Then I will do:

$newProject= new TblProject;