Yii Framework Forum: Strange error from phpunit - Yii Framework Forum

Jump to content

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

Strange error from phpunit

#1 User is offline   yii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 25-July 09

Posted 10 October 2010 - 01:28 PM

Hi,

I've got an strange error from phpunit.

root@xme-laptop:/var/www/trackstar2/protected/tests# phpunit unit/


EPHP Fatal error: Call to a member function load() on a non-object in /var/www/yii/framework/test/CDbTestCase.php on line 116


where is the problem?
thx!
Meine Fragen stelle ich öffentlich und baue somit eine Wissensdatenbank für andere auf!
0

#2 User is offline   digitalzombie 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 19-August 10

Posted 19 October 2010 - 06:12 PM

What chapter are you on...? Is that the exact msg you got from phpunit?

I had something similar and it's because I put the authMan RBAC at the bottom of the main.php file... I ended up putting it just under the DB connection component like the source code.
0

#3 User is offline   jefftulsa 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 168
  • Joined: 06-October 08
  • Location:Austin, TX

Posted 20 October 2010 - 10:10 PM

This can often be the result of an underlying database connection issue.

One thing you could do is to fire up the yiic interactive shell, loading your test config
% YIIROOT/framework/yiic shell protected/config/test.php 


And then see if you can retrieve an instance of the fixture mgr:

>> print_r(Yii::app()->getComponent('fixture'));


You should get back a CDbFixtureManager Object. If not this may display a DB error which will help you further troubleshoot the issue.
0

#4 User is offline   edward_bw 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 04-November 10

Posted 16 December 2010 - 06:24 AM

I was having the same issue with chapter 3 'Adding Tasks' (page 124/125 'Adding User and ProjectUserAssignment fixtures').

I undid everything and the tests worked so then slowly added parts back in - I found that simply adding a file to the fixtures area caused issue (protected/tests/fixtures/tbl_user.php).

I fixed this by adding in more data to the fixtures file - the book has empty entries for login and create times and id's - by making sure all fixture entries have data the error goes.

Might be useful to someone ?!

(Probably my stricter data definitions in the database...)

(Using Yii 1.1.4 too which probably doesn't help but there shouldn't be too many issues I'm hoping).

Ed
0

#5 User is offline   MichaelG 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 19-October 10
  • Location:Roseville, CA

Posted 11 March 2011 - 02:39 PM

thanks jefftulsa!

I just had the same problem. Your suggestion revealed something wrong with my database connectivity.
I restarted my wampserver and my problems went away.

I don't want to admit how much other crazy stuff I was trying to do to resolve this error.
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