for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Tests\Unit\Task;
use AspectMock\Test as test;
class WatchTest extends \Codeception\TestCase\Test
{
/**
* @var \AspectMock\Proxy\AnythingClassProxy
*/
protected $resourceWatcher;
public function _before()
if (!class_exists('Lurker\\ResourceWatcher')) {
$this->resourceWatcher = test::spec(
'Lurker\ResourceWatcher',
[
'start' => true,
'track' => true,
'addListener' => true
]
)->make();
} else {
$this->resourceWatcher = test::double(
);
}
public function testMonitorWithOneEvent()
$task = new \Robo\Task\Base\Watch($this);
$task->monitor(
'src',
function () {
//do nothing
},
1 // CREATE
)->run();
$this->resourceWatcher->verifyInvokedOnce('track');
public function testMonitorWithTwoEvents()
array(1, 4)
array<integer,integer,{"...nteger","1":"integer"}>
integer
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
1, //CREATE
4, //DELETE
$this->resourceWatcher->verifyInvokedMultipleTimes('track', 2);
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: