Completed
Push — master ( f61da2...430ae5 )
by Sam
03:08
created

AuthenticationRequestTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testConstructor() 0 4 1
1
<?php
2
3
namespace Jalle19\StatusManager\Test\Message\Request;
4
5
use Jalle19\StatusManager\Message\Request\AuthenticationRequest;
6
7
/**
8
 * Class AuthenticationRequestTest
9
 * @package   Jalle19\StatusManager\Test\Message\Request
10
 * @copyright Copyright &copy; Sam Stenvall 2016-
11
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
12
 */
13
class AuthenticationRequestTest extends \PHPUnit_Framework_TestCase
14
{
15
16
	/**
17
	 * Tests that the constructor validation is working
18
	 *
19
	 * @expectedException \Jalle19\StatusManager\Exception\MalformedRequestException
20
	 */
21
	public function testConstructor()
22
	{
23
		new AuthenticationRequest(['very invalid']);
1 ignored issue
show
Documentation introduced by
array('very invalid') is of type array<integer,string,{"0":"string"}>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
24
	}
25
26
}
27