AuthenticationRequestTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructor() 0 4 1
A testPayload() 0 4 1
1
<?php
2
3
namespace Jalle19\StatusManager\Test\Message\Request;
4
5
use Jalle19\StatusManager\Exception\MalformedRequestException;
6
use Jalle19\StatusManager\Message\Request\AuthenticationRequest;
7
use PHPUnit\Framework\TestCase;
8
9
/**
10
 * Class AuthenticationRequestTest
11
 * @package   Jalle19\StatusManager\Test\Message\Request
12
 * @copyright Copyright &copy; Sam Stenvall 2016-
13
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
14
 */
15
class AuthenticationRequestTest extends TestCase
16
{
17
18
	/**
19
	 * Tests that the constructor validation is working
20
	 *
21
	 *
22
	 */
23
	public function testConstructor()
24
	{
25
		$this->expectException(MalformedRequestException::class);
26
		new AuthenticationRequest(['very invalid']);
0 ignored issues
show
Bug introduced by
array('very invalid') of type array<integer,string> is incompatible with the type string expected by parameter $accessToken of Jalle19\StatusManager\Me...nRequest::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

26
		new AuthenticationRequest(/** @scrutinizer ignore-type */ ['very invalid']);
Loading history...
27
	}
28
29
30
	/**
31
	 *
32
	 */
33
	public function testPayload()
34
	{
35
		$request = new AuthenticationRequest('token');
36
		$this->assertEquals('token', $request->getAccessToken());
37
	}
38
39
}
40