PHP code example of codexpertmy / tests

1. Go to this page and download the library: Download codexpertmy/tests library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codexpertmy / tests example snippets


 

use Codexpert\Faker\HttpFaker;
use PHPUnit\Framework\TestCase as PHPUnit;

class DemoTest extends PHPUnit 
{
    public function test_should_create_task()
    {   
        $expected = HttpFaker::create()->shouldResponseJson(200,[],'{"status":200,"data":{}}');

        //this will return guzzle client interface
        $expected->faker();

        $response = $expected->faker()->post('/tasks');

        echo $response->getBody();
        echo $response->getStatusCode();

    }  
}