Completed
Push — master ( 6239a3...1c8aa0 )
by Tobias
07:52
created

RoundDateTimeSpec::it_is_a_specification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace tests\Happyr\DoctrineSpecification\Result;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\AbstractQuery;
7
use Doctrine\ORM\Query\Parameter;
8
use Happyr\DoctrineSpecification\Result\RoundDateTime;
9
10
/**
11
 * @mixin RoundDateTime
12
 */
13
class RoundDateTimeSpec
14
{
15
    private $roundSeconds = 3600;
16
17
    public function let()
18
    {
19
        $this->beConstructedWith($this->roundSeconds);
0 ignored issues
show
Bug introduced by
The method beConstructedWith() does not seem to exist on object<tests\Happyr\Doct...sult\RoundDateTimeSpec>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20
    }
21
22
    public function it_is_a_specification()
23
    {
24
        $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Result\RoundDateTime');
0 ignored issues
show
Bug introduced by
The method shouldBeAnInstanceOf() does not seem to exist on object<tests\Happyr\Doct...sult\RoundDateTimeSpec>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
    }
26
27
    public function it_round_date_time_in_query_parameters_for_given_time(
28
        AbstractQuery $query,
29
        Parameter $scalarParam,
30
        Parameter $datetimeParam
31
    ) {
32
        $name = 'now';
33
        $type = 'datetime';
34
        $date = new \DateTime('15:55:34');
35
36
        $scalarParam->getValue()->willReturn('foo');
37
38
        $datetimeParam->getValue()->willReturn($date);
39
        $datetimeParam->getName()->willReturn($name);
40
        $datetimeParam->getType()->willReturn($type);
41
42
        $query->getParameters()->willReturn(new ArrayCollection([$scalarParam, $datetimeParam]));
0 ignored issues
show
Bug introduced by
The method willReturn() does not seem to exist on object<Doctrine\Common\C...ctions\ArrayCollection>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
        $query->setParameter($name, new \DateTime('15:00:00'), $type)->shouldBeCalled();
0 ignored issues
show
Bug introduced by
The method shouldBeCalled() does not seem to exist on object<Doctrine\ORM\AbstractQuery>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
44
45
        $this->modify($query);
0 ignored issues
show
Bug introduced by
The method modify() does not seem to exist on object<tests\Happyr\Doct...sult\RoundDateTimeSpec>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
    }
47
}
48