Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Unit Testing - Run All Tests

I'm pretty new to both Laravel and PHPUnit, and I'm using Laravel 4 on Ubuntu 12.04.

When I run phpunit from my project's home directory, it runs the ExampleTest.php test that comes with Laravel. I created my own sample test (exactly like their example and in the same directory, only the file and test are renamed and do something different), and ran phpunit again like before; but it still only ran ExampleTest.php--not my created test. But if I run phpunit path/to/myTest, it runs my test just fine. So I feel like this is a dumb question, but how do I run all of the tests with one command (I thought phpunit should've done that)?

Thanks for the help!

like image 778
MuffinTheMan Avatar asked Jul 30 '13 00:07

MuffinTheMan


1 Answers

Your tests need to finish with ...Test.php to run automatically. So change

app/tests/TestCreateEvent.php

to

app/tests/CreateEventTest.php

and it should work.

Also make sure you rename the model inside the test to "class CreateEventTest extends TestCase"

like image 159
Laurence Avatar answered Sep 20 '22 21:09

Laurence