1. Go to this page and download the library: Download atoum/bdd-extension library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
atoum / bdd-extension example snippets
public function should_format_underscore_separated_method_name()
{
$this
->given($formatter = new testedClass())
->then
->invoking->format(__FUNCTION__)->on($formatter)
->shouldReturn('should format underscore separated method name')
;
}
// .atoum.php
$extension = new bdd\extension($script);
$runner->addExtension($extension);
namespace jubianchi\example\specs;
use atoum;
use jubianchi\example\formatter as testedClass;
class formatter extends atoum\spec
{
public function should_format_underscore_separated_method_name()
{
$this
->given($formatter = new testedClass())
->then
->invoking->format(__FUNCTION__)->on($formatter)
->shouldReturn('should format underscore separated method name')
;
}
public function shouldFormatCamelCaseMethodName()
{
$this
->given($formatter = new testedClass())
->then
->invoking->format(__FUNCTION__)->on($formatter)
->shouldReturn('should format camel case method name')
;
}
public function should_formatMixed__MethodName()
{
$this
->given($formatter = new testedClass())
->then
->invoking->format(__FUNCTION__)->on($formatter)
->shouldReturn('should format mixed method name')
;
}
}
namespace jubianchi\example\specs;
use atoum;
use jubianchi\example\formatter as testedClass;
class formatter extends atoum\spec
{
public function should_invoke_method()
{
$this
->given($formatter = new testedClass())
->then
->invoking->format(__FUNCTION__)->on($formatter)
// ...
;
}
}
namespace jubianchi\example\specs;
use atoum;
use jubianchi\example\formatter as testedClass;
class formatter extends atoum\spec
{
public function should_format_underscore_separated_method_name()
{
$this
->given($formatter = new testedClass())
->then
->invoking->format(__FUNCTION__)->on($formatter)
->shouldReturn('should format underscore separated method name')
;
}
}
namespace jubianchi\example\specs;
use atoum;
use jubianchi\example\formatter as testedClass;
class formatter extends atoum\spec
{
public function should_format_underscore_separated_method_name()
{
$this
->given($formatter = new testedClass())
->then
->invoking->format(uniqid())->on($formatter)
->shouldThrow('invalidArgumentException')
;
}
}