2017 © Pedro Peláez
 

library firetest

A Lightweight PHP Testing Framework

image

ua1-labs/firetest

A Lightweight PHP Testing Framework

  • Sunday, June 10, 2018
  • by joshualjohnson
  • Repository
  • 1 Watchers
  • 2 Stars
  • 51 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 122 % Grown

The README.md

FireTest - PHP Automated Testing

A Lightweight PHP Testing Framework, (*1)

Documentation

https://ua1.us/projects/firetest/, (*2)

Configure The Test Runner

FireTest can be configured so that it can be ran from either directly the command line or from your composer run-scripts., (*3)

Running directly from the command line:, (*4)

php vendor/ua1-labs/firetest/scripts/runner.php --dir=[directory] --ext=[fireExt]

The runner.php file is a script meant to bootstrap your test suite together to make it easier to configure your test runner. It accepts two parameters. [directory] is the directory you would like to scan to search for your test files. [fileExt] is the file extension FireTest should look for when it is scanning for tests., (*5)

Example:, (*6)

php vendor/ua1-labs/firetest/scripts/runner.php --dir=src --ext=.TestCase.php

In the example above, the test suite will search through your src directory for all files with the extension .TestCase.php., (*7)

Running as a Composer Run-Script:, (*8)

To run FireTest as a composer test script all you need to do is configure the run-script to run the runner.php script and point it to the directory you want and the file extension you want it to find. You will find run-script configurations in your composer.json file located at the configuration scripts., (*9)

"scripts": {
    "test": "php vendor/ua1-labs/firetest/scripts/runner.php --dir=/src --ext=.TestCase.php"
}

Once you have it configured all you need to do is run the test script using Composer., (*10)

composer test

Creating Your First Test

To create your first test, you will need to start out by creating your test file. Your test file will consist of a class you create which will extend the class UA1Labs\Fire\Test\TestCase., (*11)

Example:, (*12)

use UA1Labs\Fire\Test\TestCase;

class MyTestCase extends TestCase
{
    //my test suite logic
}

Once you test suite is loaded and initialized, the FireTest will iterate through all your methods that begin with the name test and run each one., (*13)

Example:, (*14)

public function testMyMethod()
{
    //my test logic
}

Asserting

At some point, you will most likely want to assert something with your test method. Because you extended the Fire\Test\TestCase class, you have access to two methods called UA1Labs\Fire\Test\TestCase::should($statement) and UA1Labs\Fire\Test\TestCase::assert($true). The should method provides you a way to tell us what your assert is going to do. Think of it like "this test should...". The assert method evaluates the $true parameter to determine a pass or fail. $true must evaluate to a true boolean value., (*15)

Example:, (*16)

$this->should('Should be set to true.')
// do some scaffolding to setup your test
$this->assert(true);

FireTest Logging

You have the ability to log out information as your tests are running. Fire\Test\Suite::log() is a static method you can use to log out information as your test is running., (*17)

The Versions

10/06 2018

dev-master

9999999-dev

A Lightweight PHP Testing Framework

  Sources   Download

MIT

The Development Requires

by Joshua L Johnson
by UA1 Labs

test testing unittest unit fire unit test firestudio firedb firetest ua1labs ua1-labs ua1

10/06 2018

1.1.0

1.1.0.0

A Lightweight PHP Testing Framework

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test testing unittest unit fire unit test firestudio firedb firetest ua1labs ua1-labs ua1

22/05 2018

dev-release-1.0.1

dev-release-1.0.1

A Lightweight PHP Testing Framework

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test testing unittest unit fire unit test firestudio firedb firetest ua1labs ua1-labs ua1

22/05 2018

1.0.1

1.0.1.0

A Lightweight PHP Testing Framework

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test testing unittest unit fire unit test firestudio firedb firetest ua1labs ua1-labs ua1