gralhao / gralhao-test
Pack of tools to make simple Gralhao application tests
1.0.1
2020-08-08 03:13 UTC
Requires
- phpunit/phpunit: ^9.2
Requires (Dev)
- gralhao/gralhao: ^1.0
- phalcon/ide-stubs: dev-master
- squizlabs/php_codesniffer: ^3.0@dev
This package is auto-updated.
Last update: 2025-03-08 13:29:56 UTC
README
gralhao/gralhao-test
A pack of tools to make simple Gralhao application tests
Index
About
This library extends PHP Unit and all PHP Unit features still available.
Getting Started
Prerequisites
PHP ^7.4, Phalcon ^4.x, Gralhao ^1.x
Usage
Installing
composer require gralhao/gralhao-test
Creating test classes:
class MyClassTest extends \Gralhao\Test\TestCase { }
Bootstraping:
public function testReturnAnApplicationInstance(): void { $this->bootstrap()->setConfig([ 'modules' => [] ]); $this->assertInstanceOf(\Phalcon\Mvc\Micro::class, $this->getApp()); }
Testing collections:
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); }
Built Using
Authors
- @mocallu - Idea & Initial work
See also the list of contributors who participated in this project.