for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace tests\Dekalee\NightlyTaskBundle\Bag;
use Dekalee\NightlyTaskBundle\Bag\TasksBag;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Command\Command;
class TasksBagTest extends TestCase
{
/**
* @var TasksBag
*/
protected $bag;
* Set up the test
public function setUp()
$this->bag = new TasksBag();
}
* Test get tasks with priority
public function testGetTaskWithPriority()
$command1 = $this->createMock(Command::CLASS);
$command2 = $this->createMock(Command::CLASS);
$command3 = $this->createMock(Command::CLASS);
$this->bag->addTask($command1, 10);
$command1
object<PHPUnit\Framework\MockObject\MockObject>
object<Symfony\Component\Console\Command\Command>
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);
$this->bag->addTask($command2, 20);
$command2
$this->bag->addTask($command3, 20);
$command3
$this->assertSame([
20 => [
$command2,
],
10 => [
]
], $this->bag->getTasks());
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: