aboutsummaryrefslogtreecommitdiffstats
path: root/public/system/storage/vendor/cardinity/cardinity-sdk-php/spec/Exception/InvalidAttributeValueSpec.php
blob: 7bea5f5f0bfa40fd7cee7d068fa13b4a37f4f84f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

namespace spec\Cardinity\Exception;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Validator\ConstraintViolationList;

class InvalidAttributeValueSpec extends ObjectBehavior
{
    private $violation = 'This value should not be blank.';

    function let(ConstraintViolationList $violations)
    {
        $violations->__toString()->willReturn($this->violation);

        $this->beConstructedWith(
            'Message',
            $violations
        );
    }

    function it_is_initializable()
    {
        $this->shouldHaveType('\RuntimeException');
    }

    function it_returns_message()
    {
        $this->getMessage()->shouldStartWith('Message');
    }

    function it_returns_violations(ConstraintViolationList $violations)
    {
        $this->getViolations()->shouldReturn($violations);
    }

    function it_should_have_message_containing_violations()
    {
        $string = 'Violations: ' . $this->violation;
        $this->getMessage()->shouldEndWith($string);
    }
}