You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vonglasow f1586e731c
Merge pull request #1 from vonglasow/bors
2 years ago
resources first version 2 years ago
src hoaOption asserter to option 2 years ago
tests/units hoaOption asserter to option 2 years ago
.atoum.php first version 2 years ago
.gitignore first version 2 years ago
.travis.yml chore(Bors) Configuring Bors-ng 2 years ago
README.md update following commetns from hoaproject:Central#80 2 years ago
bors.toml chore(Bors) Configuring Bors-ng 2 years ago
composer.json update following commetns from hoaproject:Central#80 2 years ago

README.md

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.