Completed
Pull Request — master (#417)
by Garry
166:19
created

ArgumentTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_returns_true_if_all_values_are_found_in_an_array() 0 6 1
A it_returns_false_if_a_value_is_missing_from_an_array() 0 6 1
A it_returns_true_if_all_pairs_are_found_in_an_array() 0 6 1
A it_returns_false_if_pair_is_missing_from_an_array() 0 6 1
1
<?php
2
3
namespace Tests\Prophecy\Argument;
4
5
use Prophecy\Argument;
6
use PHPUnit\Framework\TestCase;
7
8
class ArgumentTest extends TestCase
9
{
10
    /**
11
     * @test
12
     */
13
    public function it_returns_true_if_all_values_are_found_in_an_array()
14
    {
15
        $token = Argument::containingAllOf('a', 'b');
16
17
        $this->assertSame(6.5, $token->scoreArgument(['a', 'b', 'c']));
18
    }
19
20
    /**
21
     * @test
22
     */
23
    public function it_returns_false_if_a_value_is_missing_from_an_array()
24
    {
25
        $token = Argument::containingAllOf('b', 'c');
26
27
        $this->assertFalse($token->scoreArgument(['a', 'b', 'd']));
28
    }
29
30
    /**
31
     * @test
32
     */
33
    public function it_returns_true_if_all_pairs_are_found_in_an_array()
34
    {
35
        $token = Argument::withAllEntries(['b' => 2, 'c' => 3]);
36
37
        $this->assertSame(8, $token->scoreArgument(['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4]));
38
    }
39
40
    /**
41
     * @test
42
     */
43
    public function it_returns_false_if_pair_is_missing_from_an_array()
44
    {
45
        $token = Argument::withAllEntries(['b' => 2, 'c' => 3]);
46
47
        $this->assertFalse($token->scoreArgument(['a' => 1, 'b' => 2, 'd']));
48
    }
49
}
50