CallbackAuthenticatorTest::testAuthenticator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 14
rs 9.7998
c 0
b 0
f 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 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