Completed
Push — 1.0-payum-1.5.0 ( e4f3f5 )
by Kamil
53:12 queued 25:27
created

PropertyAccessDataExtractorSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 20
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_a_data_extractor() 0 4 1
A it_uses_property_accessor_to_extract_the_data() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace spec\Sylius\Component\Grid\DataExtractor;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Component\Grid\DataExtractor\DataExtractorInterface;
18
use Sylius\Component\Grid\Definition\Field;
19
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
20
21
final class PropertyAccessDataExtractorSpec extends ObjectBehavior
22
{
23
    function let(PropertyAccessorInterface $propertyAccessor): void
24
    {
25
        $this->beConstructedWith($propertyAccessor);
26
    }
27
28
    function it_is_a_data_extractor(): void
29
    {
30
        $this->shouldImplement(DataExtractorInterface::class);
31
    }
32
33
    function it_uses_property_accessor_to_extract_the_data(PropertyAccessorInterface $propertyAccessor, Field $field): void
34
    {
35
        $field->getPath()->willReturn('foo');
36
        $propertyAccessor->getValue(['foo' => 'bar'], 'foo')->willReturn('Value');
37
38
        $this->get($field, ['foo' => 'bar'])->shouldReturn('Value');
39
    }
40
}
41