EqualTests::evaluateFailureDataProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of the Cubiche package.
4
 *
5
 * Copyright (c) Cubiche
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Cubiche\Core\Specification\Tests\Units\Constraint;
11
12
use Cubiche\Core\Equatable\Tests\Fixtures\Value;
13
use Cubiche\Core\Specification\Criteria;
14
15
/**
16
 * Equal Tests Class.
17
 *
18
 * @author Ivannis Suárez Jerez <[email protected]>
19
 * @author Karel Osorio Ramírez <[email protected]>
20
 */
21
class EqualTests extends BinaryConstraintOperatorTestCase
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function evaluateSuccessDataProvider()
27
    {
28
        return array(
29
            array(5),
30
            array(5.0),
31
        );
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    protected function evaluateFailureDataProvider()
38
    {
39
        return array(
40
            array(4.999),
41
            array(6),
42
        );
43
    }
44
45
    /**
46
     * Test evaluate Equatable instance.
47
     */
48
    public function testEvaluateEquatable()
49
    {
50
        $this
51
            ->given($eq = Criteria::eq(new Value(5)))
52
            ->then()
53
                ->boolean($eq->evaluate(new Value(5)))
54
                    ->isTrue()
55
                ->boolean($eq->evaluate(new Value(5.0)))
56
                    ->isTrue()
57
                ->boolean($eq->evaluate(new Value(4)))
58
                    ->isFalse();
59
    }
60
}
61