Yii Framework Forum: Problem I Am Having Getting Fixtures To Work In My Tdd - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problem I Am Having Getting Fixtures To Work In My Tdd Rate Topic: -----

#1 User is offline   U4EA 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 143
  • Joined: 04-November 12

Posted 27 November 2012 - 02:10 PM

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! :( :( :(
0

#2 User is offline   U4EA 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 143
  • Joined: 04-November 12

Posted 28 November 2012 - 05:36 AM

Anyone? :(
0

#3 User is offline   redmendo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 18-March 13

Posted 21 March 2013 - 09:57 AM

It seems that PHP_Invoker is not installed. Try:
pear install pear.phpunit.de/PHP_Invoker

Also consult www.phpunit.de/manual/3.6/en/installation.html
0

#4 User is offline   le_top 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 279
  • Joined: 08-June 10
  • Location:France

Posted 05 May 2013 - 02:40 PM

As my SSD broke down, I installed the latest XAMPP, upgraded pear,etc and ended up with PHPUnit 3.7.19.

After fixing CTestCase.php (copying from Yii 1.1.13 to Yii 1.1.12), I ran into the PHP_Invoker issue.

I ended up doing the fix as indicated here:
https://github.com/b...0fd864fe2174efe

That did the job.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users