Completed
Push — master ( 0375a2...821836 )
by Ivannis Suárez
02:49
created

EqualTests   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 3
c 3
b 1
f 1
lcom 0
cbo 4
dl 0
loc 40
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A evaluateSuccessDataProvider() 0 7 1
A evaluateFailureDataProvider() 0 7 1
A testEvaluateEquatable() 0 12 1
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\EquatableObject;
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 EquatableObject(5)))
52
            ->then()
53
                ->boolean($eq->evaluate(new EquatableObject(5)))
54
                    ->isTrue()
55
                ->boolean($eq->evaluate(new EquatableObject(5.0)))
56
                    ->isTrue()
57
                ->boolean($eq->evaluate(new EquatableObject(4)))
58
                    ->isFalse();
59
    }
60
}
61