for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the Cubiche package.
*
* Copyright (c) Cubiche
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cubiche\Core\Collections\Tests\Units\Exception;
use Cubiche\Core\Collections\Exception\InvalidKeyException;
use Cubiche\Tests\TestCase;
* InvalidKeyExceptionTests class.
* @author Ivannis Suárez Jerez <[email protected]>
class InvalidKeyExceptionTests extends TestCase
{
* Test class.
public function testClass()
$this
->testedClass
->extends(\InvalidArgumentException::class)
;
}
/*
* Test forKey method.
public function testForKey()
->given($cause = new \Exception('some cause'))
->when($exception = InvalidKeyException::forKey('foo', '', $cause))
->then
->object($exception)
->isInstanceOf(InvalidKeyException::class)
->integer($exception->getCode())
->isEqualTo(0)
->object($exception->getPrevious())
->isIdenticalTo($cause)
->given($exception = InvalidKeyException::forKey('bar'))
->variable($exception->getPrevious())->isNull()