CakeRepository::findBySlug()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
namespace spec\Knp\RadBundle\Resource\Resolver;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Argument;
7
8
class ExpressionLanguageBasedSpec extends ObjectBehavior
9
{
10
    /**
11
     * @param Symfony\Component\DependencyInjection\ContainerInterface $container
12
     * @param Symfony\Component\HttpFoundation\Request $request
13
     * @param Symfony\Component\HttpFoundation\ParameterBag $attributes
14
     * @param spec\Knp\RadBundle\Resource\Resolver\CakeRepository $cakeRepository
15
     * @param stdClass $cake
16
     */
17
    function let($container, $request, $cakeRepository, $attributes, $cake)
0 ignored issues
show
Unused Code introduced by
The parameter $cake is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
        $this->beConstructedWith($container);
20
        $container->get('orm.cake_repository')->willReturn($cakeRepository);
21
        $request->attributes = $attributes;
22
    }
23
24
    function its_resolveResource_uses_ExpressionLanguage($request, $attributes, $cake, $cakeRepository)
0 ignored issues
show
Coding Style introduced by
Method name "ExpressionLanguageBasedSpec::its_resolveResource_uses_ExpressionLanguage" is not in camel caps format
Loading history...
25
    {
26
        $attributes->get('test')->willReturn('value!');
27
        $cakeRepository->findBySlug('value!')->shouldBeCalled()->willReturn($cake);
28
        $this->resolveResource($request, array('expr' => "service('orm.cake_repository').findBySlug(request.attributes.get('test'))"))->shouldReturn($cake);
29
    }
30
}
31
32
class CakeRepository
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
33
{
34
    public function findBySlug($slug)
0 ignored issues
show
Unused Code introduced by
The parameter $slug is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
    {
36
    }
37
38
    public function findByRegionAndSlug($region, $slug)
0 ignored issues
show
Unused Code introduced by
The parameter $region is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $slug is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
    {
40
    }
41
}
42