Hi folks,
I am reading my way through the Agile Development book. Firstly, I am aware there are a number of errors in the book, but this doesnt seem to be one - it seems to be something outside that.
I am following the creaction of the Trackstar application in the book, but I am modifying it for my own application. Instead of creating and TDD-testing the table/model Project, I am using a table/model Customer.
I have managed to get the initial CRUD tests to work fine, but an issue arises when I switch the test data to fixtures instead of $modelInstance->setAttributes.
I have created this fixtures array in \tests\fixtures\tbl_customer.php
<?php
return array(
'customer1'=>array(
'salutation' => 1,
'first_name' => 'Test First Name',
'middle_name' => 'Test Middle Name',
'last_name' => 'Test Last Name',
'address_id' => 1,
)
);
In tests\unit\CustomerTest.php I have the following…
<?php
class CustomerTest extends CDbTestCase
{
public $fixtures=array('customers'=>'Customer');
public function testRead()
{
}
}
If I run this with the fixtures declaration commented out, it runs fine, with PHPUnit just telling me 1 test, 0 assertions (as you would expect). However, if I run it without the $fixtures declaration commented out, I get an error message like below…
There was 1 error:
1) CustomerTest::testRead
Warning: include(PHP_Invoker.php): Failed to open stream: No such file or directory in C:xampp\htdocs\YiiRoot\framework\YiiBase.php on line 423
Warning: include(): Failed opening 'PHP_Invoker.php' for inclusion...
I am not an expert in PHP or error messages (although I consider myself reasonably advanced) but it looks to me like it is not able to establish the class of Customer established in the fixtures file. Is that correct? I know it is finding the fixtures file because I put a echo statement at the top of it and it is echoing that back to PHPUnit OK.
I would greatly, greatly appreciate any help in resolving this. I am trying to develop my first proper website in a framework. I have being working a studying diligently and I have been trying to resolve this problem for a couple hours to no avail. If I can’t resolve this, I can’t just move onto the next stage as unit testing is so crucial to application development.
Please help me!