An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

        



Gralhao logo

gralhao/gralhao-test

[![Latest Stable Version](https://img.shields.io/packagist/v/gralhao/gralhao-test.svg?style=flat-square)](https://packagist.org/packages/gralhao/gralhao-test)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.4-8892BF.svg)](https://php.net/)
[![Build Status](https://travis-ci.com/gralhao/gralhao-test.svg?branch=master)](https://travis-ci.com/gralhao/gralhao-test)
[![Status](https://img.shields.io/badge/status-active-success.svg)]()
[![License](https://img.shields.io/badge/license-BSD-blue.svg)](/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.

## Getting Started

### 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 work

See 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)