https://github.com/gralhao/gralhao-test
A pack of tools to make simple Gralhao application tests.
https://github.com/gralhao/gralhao-test
gralhao phalcon phpunit testing-tools
Last synced: 3 months ago
JSON representation
A pack of tools to make simple Gralhao application tests.
- Host: GitHub
- URL: https://github.com/gralhao/gralhao-test
- Owner: gralhao
- License: bsd-3-clause
- Created: 2020-08-02T00:48:11.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-08T03:22:30.000Z (almost 5 years ago)
- Last Synced: 2024-11-16T17:44:58.635Z (6 months ago)
- Topics: gralhao, phalcon, phpunit, testing-tools
- Language: PHP
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
gralhao/gralhao-test
[](https://packagist.org/packages/gralhao/gralhao-test)
[](https://php.net/)
[](https://travis-ci.com/gralhao/gralhao-test)
[]()
[](/LICENSE)---
A pack of tools to make simple Gralhao application tests
## Index
- [About](#about)
- [Getting Started](#getting_started)
- [Usage](#usage)
- [Built Using](#built_using)
- [Authors](#authors)
- [Acknowledgments](#acknowledgement)## About
This library extends [PHP Unit](https://github.com/sebastianbergmann/phpunit) and all PHP Unit features still available.### Prerequisites
PHP ^7.4, Phalcon ^4.x, Gralhao ^1.x### Usage
Installing
```bash
composer require gralhao/gralhao-test
```
Creating test classes:
```php
class MyClassTest extends \Gralhao\Test\TestCase
{
}
```Bootstraping:
```php
public function testReturnAnApplicationInstance(): void
{
$this->bootstrap()->setConfig([
'modules' => []
]);
$this->assertInstanceOf(\Phalcon\Mvc\Micro::class, $this->getApp());
}
```Testing collections:
```php
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
- [PHP Unit](https://github.com/sebastianbergmann/phpunit)
- [Gralhao](https://github.com/gralhao/gralhao)
- [Phalcon](https://phalcon.io/)## Authors
- [@mocallu](https://github.com/mocallu) - Idea & Initial workSee also the list of [contributors](https://github.com/gralhao/gralhao-test/contributors) who participated in this project.
## Acknowledgements
- [Phalcon Project](https://phalcon.io)
- [A.K.A. Gralhao](https://en.wikipedia.org/wiki/Red-throated_caracara)