CallbackTests   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A newDefaultTestedInstance() 0 6 1
A testApply() 0 10 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\Selector\Tests\Units;
11
12
/**
13
 * Callback Tests Class.
14
 *
15
 * @author Ivannis Suárez Jerez <[email protected]>
16
 */
17
class CallbackTests extends SelectorTestCase
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function newDefaultTestedInstance()
23
    {
24
        return $this->newTestedInstance(function ($value) {
25
            return $value + 1;
26
        });
27
    }
28
29
    /**
30
     * Test apply.
31
     */
32
    public function testApply()
33
    {
34
        $this
35
            /* @var \Cubiche\Core\Selector\Callback $callback */
36
            ->given($callback = $this->newDefaultTestedInstance())
37
            ->then()
38
                ->integer($callback->apply(1))
39
                    ->isEqualTo(2)
40
        ;
41
    }
42
}
43