How to write a test case in laravel using phpunit

Test Case in Laravel with phpunit

<?php namespace Alo\Tracker;

/**
 * Description of TaskAPIControllerTest
 *
 * @author 
 */
class TaskAPIControllerTest extends \TestCase
{

 public function testIndex()
 {
    $crawler = $this->client->request('GET', 'apiv1/tasks');
    $this->assertResponseOk();
 }

}

Create a php file inside app/tests folder, name the file such that it ends with prefix Test, and extend TestCase class.

Leave a Reply