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

testRefreshTimestampSessionAfterTimeout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 15
rs 10
cc 1
nc 1
nop 0
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