1. Go to this page and download the library: Download gralhao/gralhao-test 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/ */
gralhao / gralhao-test example snippets
class MyClassTest extends \Gralhao\Test\TestCase
{
}
public function testReturnAnApplicationInstance(): void
{
$this->bootstrap()->setConfig([
'modules' => []
]);
$this->assertInstanceOf(\Phalcon\Mvc\Micro::class, $this->getApp());
}
public function testReturnAValidRequestResponse(): void
{
$request = new \Gralhao\Test\Request();
$request->setMethod('POST')
->setPath('/test')
->setHeader('key', 'value')
->setBody('test');
$response = $this->dispatch($request);
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('test', $response->data->body);
$this->assertEquals('value', $response->data->headers->key);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.