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

CallbackAuthenticatorTest::testAuthenticator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 14
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
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