Failed Conditions
Push — master ( b1d4df...5a9cf3 )
by David
04:05
created

RefreshSessionTimestampMiddlewareTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 7
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testRefreshTimestampSessionAfterTimeout() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApplicationTest\Middleware;
6
7
use Application\Middleware\RefreshSessionTimestampMiddleware;
8
use Laminas\Diactoros\ServerRequest;
9
use Mezzio\Session\Session;
10
use Mezzio\Session\SessionMiddleware;
11
use PHPUnit\Framework\TestCase;
12
13
class RefreshSessionTimestampMiddlewareTest extends TestCase
14
{
15
    public function testRefreshTimestampSessionAfterTimeout(): void
16
    {
17
        $session = new Session(['user' => '1234']);
18
19
        $request = (new ServerRequest())->withAttribute(SessionMiddleware::SESSION_ATTRIBUTE, $session);
20
        $middleware = new RefreshSessionTimestampMiddleware();
21
22
        /**
23
         * @var \Psr\Http\Server\RequestHandlerInterface $handler
24
         */
25
        $handler = $this->createMock(\Psr\Http\Server\RequestHandlerInterface::class);
26
27
        $middleware->process($request, $handler);
28
29
        self::assertTrue($session->has('_last_access'));
30
    }
31
}
32