TestCase::getYoutubeMock()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is a part of nekland youtube api package
5
 *
6
 * (c) Nekland <[email protected]>
7
 *
8
 * For the full license, take a look to the LICENSE file
9
 * on the root directory of this project
10
 */
11
12
namespace Nekland\Tests\Api;
13
14
15
use Nekland\YoutubeApi\Youtube;
16
use Prophecy\Argument;
17
18
class TestCase extends \PHPUnit_Framework_TestCase
19
{
20
    /**
21
     * @param array $data an array of method => return for the httpclient mocked
22
     * @return Youtube
23
     */
24
    protected function getYoutubeMock(array $data)
25
    {
26
        $httpClient = $this->prophesize('Nekland\BaseApi\Http\ClientInterface');
27
28
        foreach($data as $method => $return) {
29
            $httpClient->$method(Argument::cetera())->willReturn($return);
30
        }
31
32
        return new Youtube($httpClient->reveal());
33
    }
34
}
35