FactoryTest::testUnknownRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Jalle19\StatusManager\Test\Message;
4
5
use Jalle19\StatusManager\Exception\MalformedRequestException;
6
use Jalle19\StatusManager\Exception\UnknownRequestException;
7
use Jalle19\StatusManager\Message\Factory;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * Class FactoryTest
12
 * @package   Jalle19\StatusManager\Test\Message
13
 * @copyright Copyright &copy; Sam Stenvall 2016-
14
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
15
 */
16
class FactoryTest extends TestCase
17
{
18
19
	public function testMalformedRequest()
20
	{
21
		$this->expectException(MalformedRequestException::class);
22
		Factory::factory(json_encode([
23
			'payload' => 'foo',
24
		]));
25
	}
26
27
28
	public function testUnknownRequest()
29
	{
30
		$this->expectException(UnknownRequestException::class);
31
		Factory::factory(json_encode([
32
			'type' => 'totally invalid',
33
		]));
34
	}
35
36
}
37