for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Tests\Collection;
use PHPUnit\Framework\TestCase;
use TrelloCycleTime\Collection\CycleTimesCollection;
use TrelloCycleTime\ValueObject\HistoryCard;
class CycleTimeCollectionTest extends TestCase
{
private $cycleTimeCollection;
public function setUp()
$this->cycleTimeCollection = new CycleTimesCollection();
}
public function testGetAllCycleTimeColumnsWithEmptyData()
$cycleTime = $this->cycleTimeCollection->getFromCardHistory([]);
$this->assertEquals([], $cycleTime);
public function testGetAllCycleTimeColumns()
$from = 'from';
$to = 'to';
$cardHistory = $this->prophesize(HistoryCard::class);
$cardHistory->getFrom()->willReturn($from);
$cardHistory->getTo()->willReturn($to);
$cardHistory2 = $this->prophesize(HistoryCard::class);
$cardHistory2->getFrom()->willReturn($from);
$cardHistory2->getTo()->willReturn($to);
$cardHistories = [
$cardHistory->reveal(),
$cardHistory2->reveal()
];
$cycleTimes = $this->cycleTimeCollection->getFromCardHistory($cardHistories);
$this->assertCount(1, $cycleTimes);
$cycleTimes
array
object<Countable>|object...nit\Framework\iterable>
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);
foreach ($cycleTimes as $cycleTimeColumn) {
$this->assertEquals('from', $cycleTimeColumn->getFrom());
$this->assertEquals('to', $cycleTimeColumn->getTo());
$this->assertEquals('from_to', $cycleTimeColumn->getName());
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: