I'm trying to start writing tests within Laravel. I think it is good practice to write my own basic TestCase, that runs the test setup (for example migrations).
<?php
class TestCase extends PHPUnit_Framework_TestCase {
public function setUp()
{
parent::setUp();
// just for example:
DB::table('categories')->first();
}
}
After that, I want to inherit all my TestCases from the one created above
<?php
class TestExample extends TestCase {
public function testSomethingIsTrue()
{
$this->assertTrue(true);
}
}
So now I have three problems:
My TestCase throws error, class DB not found. Why the heck is the test not autoloading Laravel Framework Classes?
PHPUnit tells me (with a warning) that my TestCase does not contain any tests, but that is my suspected behaviour for this class, how can I avoid this message?
My TestExample cannot find the class TestCase.
Can you help me understanding that?! How can I configure a test specific autoloading?
UPDATE: Answer 1: Because I run the tests in NetBeans IDE, that needs to be configured! Setting up the right phpunit.xml helped
Artisan
is a Laravel 4 class, mixing up? – Muhammad Usman