Completed
Pull Request — dev (#11)
by
unknown
04:51
created

CallbackAuthenticatorTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testAuthenticator() 0 14 1
1
<?php
2
3
namespace Vectorface\SnappyRouterTests\Authentication;
4
5
use \PHPUnit_Framework_TestCase;
6
use Vectorface\SnappyRouter\Authentication\CallbackAuthenticator;
7
8
class CallbackAuthenticatorTest extends PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * A basic test showing standard functionality.
12
     * The fact that no exception is thrown indicates we do not exceed any of
13
     * the listed rules.
14
     */
15
    public function testAuthenticator()
16
    {
17
        $bool = true;
18
        $auth = new CallbackAuthenticator(function () use ($bool) {
19
            return $bool;
20
        });
21
        $this->assertTrue($auth->authenticate(array('a', 'b')));
22
23
        $bool = false;
24
        $auth = new CallbackAuthenticator(function () use ($bool) {
25
            return $bool;
26
        });
27
        $this->assertFalse($auth->authenticate(array('a', 'b')));
28
    }
29
}
30