for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace spec\Knp\RadBundle\Resource\Resolver\OptionsBased;
use PhpSpec\ObjectBehavior;
class ArgumentResolverSpec extends ObjectBehavior
{
/**
* @param Knp\RadBundle\HttpFoundation\RequestManipulator $requestManipulator
* @param Symfony\Component\HttpFoundation\Request $request
*/
function let($requestManipulator, $request)
$request
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$this->beConstructedWith($requestManipulator);
}
function it_should_resolve_scalar_arguments($request)
$this->resolveArgument($request, array('value' => 'the value'))->shouldReturn('the value');
function it_should_resolve_path_arguments($requestManipulator, $request)
$requestManipulator->getAttribute($request, 'slug')->shouldBeCalled()->willReturn('mimolette');
$this->resolveArgument($request, array('name' => 'slug'))->shouldReturn('mimolette');
function it_should_throw_exception_when_an_argument_has_both_value_and_name($request)
$this->shouldThrow()->duringResolveArgument($request, array('name' => 'slug', 'value' => 'camember'));
function it_should_throw_exception_when_an_argument_has_no_value_nor_name($request)
$this->shouldThrow()->duringResolveArgument($request, array());
function it_should_throw_exception_when_an_argument_has_extra_keys($request)
$this->shouldThrow()->duringResolveArgument($request, array('name' => 'slug', 'foo' => 'bar'));
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.