Hoa


Build status Code coverage Packagist License

Hoa is a modular, extensible and structured set of PHP libraries.
Moreover, Hoa aims at being a bridge between industrial and research worlds.

Hoa\atoum-option-extension

Help on IRC Help on Gitter Board

This tools is an extension for atoum to help you creating your unit test for a project using hoa/Option

Installation

With Composer, to include this library into your dependencies, you need to require hoa/atoum-option-extension:

$ composer require hoa/atoum-option-extension

For more installation procedures, please read the Source page.

Testing

Before running the test suites, the development dependencies must be installed:

$ composer install

Then, to run all the test suites:

$ vendor/bin/atoum

For more information, please read the contributor guide.

Quick usage

<?php

$this->given($this->newTestedInstance)
	->option($this->testedInstance->doSomethingReturningAnOption())
		->isNone;
$this->given($this->newTestedInstance)
	->option($this->testedInstance->doSomethingReturningAnOption())
		->isSome('This should be a value');
$this->given($this->newTestedInstance)
	->option($this->testedInstance->wrapTheGivenValueInAnOption(42))
		->some()
		->integer($this->getValue())->isEqualTo(42);

New assertion defined

  • option: validated that the given value is an Option instance
    • isSome('custom failed message') or isSome: validated that the Option contains a value
    • isNone('custom failed message') or isNone: validated that the Option doesn't contains a value
    • some() or some: allow you to get the unwrapped value to chain on, validated that the value is in the option first

Getting help

There are mainly two ways to get help:

Contribution

Do you want to contribute? Thanks! A detailed contributor guide explains everything you need to know.

License

Hoa is under the New BSD License (BSD-3-Clause). Please, see LICENSE for details.