for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Tests\AppBundle\Sync\Entity;
use AppBundle\Sync\Entity\Task;
use AppBundle\Sync\Entity\TaskCollection;
/**
* Task Collection tests
*
* @author Sergey Sadovoi <[email protected]>
*/
class TaskCollectionTest extends \PHPUnit_Framework_TestCase
{
public function testAdd()
* @var Task $task
$task = $this->getMockBuilder(Task::class)
->getMock();
// Create collection
$collection = new TaskCollection();
$this->assertCount(0, $collection);
// Add task
$collection->addTask($task);
$this->assertCount(1, $collection);
// Check task
$this->assertEquals($task, $collection->get(0));
// Add task one more time
$this->assertCount(2, $collection);
}