1. Go to this page and download the library: Download atoum/visibility-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 / visibility-extension example snippets
namespace
{
class foo
{
protected function bar()
{
return 'foo';
}
}
}
namespace tests\units
{
use atoum\atoum;
class foo extends atoum\test
{
public function testBar()
{
$this
->if($sut = new \foo())
->then
->string($this->invoke($sut)->bar())->isEqualTo('foo')
;
}
}
}
// .atoum.php
use atoum\atoum\visibility;
$runner->removeExtension(visibility\extension::class);
namespace
{
class foo
{
protected function bar()
{
return $this;
}
protected function baz($arg)
{
return $arg;
}
}
}
namespace tests\units
{
use atoum\atoum;
class foo extends atoum\test
{
public function testBar()
{
$this
->if($sut = new \foo())
->then
->object($this->invoke($sut)->bar())->isIdenticalTo($sut)
;
}
public function testBaz()
{
$this
->if($sut = new \foo())
->and($arg = uniqid())
->then
->variable($this->invoke($sut)->baz($arg))->isEqualTo($arg)
;
}
}
}
namespace
{
class foo
{
public function baz()
{
return $this->bar();
}
protected function bar()
{
$args = func_get_args();
return sizeof($args) ? $args : $this;
}
}
}
namespace tests\units
{
use atoum\atoum;
class foo extends atoum\test
{
public function testBar()
{
$this
->given(
$this->mockGenerator
->makeVisible('bar')
->generate('foo')
)
->if($mockedSut = new \mock\foo)
->and($this->calling($mockedSut)->bar = 'foo')
->then
->string($mockedSut->baz())->isEqualTo('foo')
->string($mockedSut->baz())->isEqualTo('foo')
->mock($mockedSut)
->call('bar')->twice()
;
}
}
}
namespace tests\units
{
use atoum\atoum;
class foo extends atoum\test
{
public function testBar()
{
$this
->given(
$this->mockGenerator
->makeVisible('bar')
->generate('foo', 'mock', 'mockedFoo')
)
->if($mockedSut = new \mock\mockedFoo)
->and($this->calling($mockedSut)->bar = 'foo')
->then
->string($mockedSut->baz())->isEqualTo('foo')
->string($mockedSut->baz())->isEqualTo('foo')
->mock($mockedSut)
->call('bar')->twice()
;
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.