Quantcast
Channel: Anil Konsal
Viewing all articles
Browse latest Browse all 10

Automated testing with Yii – Resolving Fixtures issue

$
0
0

Hi,

If you are starting using PHPunit testing with Yii, chances are there that you may encounter an error which drove me crazy. This error occurs when you are using the fixtures to test the CRUD operations. Error will be like:

1
2
1) ContactListTest::testCreate
Exception: Unknown method 'contactLists' for class 'ContactListTest'.

You will note that my class name is ‘ContactListTest’ and my fixture file name is ‘ContactList.php’. My table name is ‘contact_list’.

The resolution to this issue is hidden in the documentation of the Yii Testing which states that the fixture file name should be same as that of the table name.

I changed the filename of fixture to ‘contact_list.php’ and it worked!!

 


Viewing all articles
Browse latest Browse all 10

Trending Articles