for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nip\Dispatcher\Tests\Commands;
use Nip\Dispatcher\Commands\Command;
use Nip\Dispatcher\Commands\CommandsCollection;
use Nip\Dispatcher\Tests\AbstractTest;
/**
* Class CommandTest
* @package Nip\Dispatcher\Tests\Commands
*/
class CommandsCollectionTest extends AbstractTest
{
public function testOverflow()
$collection = new CommandsCollection();
$collection->setMaxHops(3);
self::assertEquals(3, $collection->getMaxHops());
self::assertEquals(0, $collection->getHops());
self::assertFalse($collection->overflow());
$command = new Command();
$collection[] = $command;
self::assertEquals(2, $collection->getHops());
self::assertEquals(3, $collection->getHops());
self::expectException(\Exception::class);
PHPUnit\Framework\TestCase::expectException()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
self::/** @scrutinizer ignore-call */
expectException(\Exception::class);
self::assertTrue($collection->overflow());
}