GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 3775f1...a1ecb7 )
by Sébastien
02:32
created

CombineKeysCollectionTest::testCombineKeysAcceptsTraversable()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 21
nc 1
nop 0
dl 0
loc 27
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * Novactive Collection.
4
 *
5
 * @author    Luke Visinoni <[email protected], [email protected]>
6
 * @author    Sébastien Morel <[email protected], [email protected]>
7
 * @copyright 2017 Novactive
8
 * @license   MIT
9
 */
10
11
namespace Novactive\Tests;
12
13
use Novactive\Collection\Factory;
14
15
/**
16
 * Class CombineKeysCollectionTest.
17
 */
18
class CombineKeysCollectionTest extends UnitTestCase
19
{
20
    public function testCombineKeysUsesIncomingTraversableAsKeysForCollectionsValues()
21
    {
22
        $coll    = Factory::create($this->fixtures['names']);
23
        $orig    = $coll->toArray();
24
        $newkeys = $coll->combineKeys($this->fixtures['emails']);
25
        $this->assertEquals(
26
            [
27
                '[email protected]' => 'Chelsea',
28
                '[email protected]'       => 'Adella',
29
                '[email protected]'   => 'Monte',
30
                '[email protected]'        => 'Maye',
31
                '[email protected]'        => 'Lottie',
32
                '[email protected]'      => 'Don',
33
                '[email protected]'       => 'Dayton',
34
                '[email protected]'       => 'Kirk',
35
                '[email protected]'      => 'Troy',
36
                '[email protected]'       => 'Nakia',
37
            ],
38
            $newkeys->toArray()
39
        );
40
        $this->assertNotSame($newkeys->toArray(), $orig);
41
        $this->assertSame(
42
            $coll->toArray(),
43
            $orig,
44
            'The original collection should not be affected by Collection::combineKeys().'
45
        );
46
    }
47
48
    /**
49
     * @expectedException \InvalidArgumentException
50
     * @expectedExceptionMessage Invalid input type for combineKeys.
51
     */
52
    public function testCombineKeysThrowsExceptionIfPassedNonTraversableNonArray()
53
    {
54
        $coll = Factory::create($this->fixtures['emails']);
55
        $coll->combineKeys('this is not traversable');
56
    }
57
58
    /**
59
     * @expectedException \InvalidArgumentException
60
     * @expectedExceptionMessage Invalid input for combineKeys, number of items does not match.
61
     */
62
    public function testCombineKeysThrowsExceptionIfPassedTraversableWithBadCount()
63
    {
64
        $coll = Factory::create($this->fixtures['emails']);
65
        $coll->combineKeys([1, 2, 3]);
66
    }
67
68
    public function testCombineKeysAcceptsTraversable()
69
    {
70
        $coll        = Factory::create($this->fixtures['names']);
71
        $orig        = $coll->toArray();
72
        $iter        = $this->getIteratorForArray($this->fixtures['emails']);
73
        $keycombined = $coll->combineKeys($iter);
74
        $this->assertSame(
75
            [
76
                '[email protected]' => 'Chelsea',
77
                '[email protected]'       => 'Adella',
78
                '[email protected]'   => 'Monte',
79
                '[email protected]'        => 'Maye',
80
                '[email protected]'        => 'Lottie',
81
                '[email protected]'      => 'Don',
82
                '[email protected]'       => 'Dayton',
83
                '[email protected]'       => 'Kirk',
84
                '[email protected]'      => 'Troy',
85
                '[email protected]'       => 'Nakia',
86
            ],
87
            $keycombined->toArray()
88
        );
89
        $this->assertSame(
90
            $orig,
91
            $coll->toArray(),
92
            'Ensure that Collection::combineKeys does not change the original collection.'
93
        );
94
    }
95
}
96