Completed
Push — master ( 8f4937...fedf49 )
by smiley
03:03
created

ClassLoaderTraitTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A testClassLoaderDoesNotImplementException() 0 6 1
A testClassLoaderDoesNotExistException() 0 6 1
1
<?php
2
/**
3
 *
4
 * @filesource   ClassLoaderTraitTest.php
5
 * @created      12.02.2016
6
 * @package      chillerlan\BBCodeTest\normal\Traits
7
 * @author       Smiley <[email protected]>
8
 * @copyright    2015 Smiley
9
 * @license      MIT
10
 */
11
12
namespace chillerlan\BBCodeTest\normal\Traits;
13
14
use chillerlan\bbcode\Parser;
15
use chillerlan\bbcode\ParserOptions;
16
use ReflectionClass;
17
use stdClass;
18
19
class ClassLoaderTraitTest extends \PHPUnit_Framework_TestCase{
20
21
	/**
22
	 * @var \chillerlan\bbcode\Parser
23
	 */
24
	protected $parser;
25
26
	/**
27
	 * @var \ReflectionClass
28
	 */
29
	protected $reflectionClass;
30
31
	protected function setUp(){
32
		$this->reflectionClass = new ReflectionClass(Parser::class);
33
	}
34
35
	/**
36
	 * @expectedException \chillerlan\BBCode\BBCodeException
37
	 * @expectedExceptionMessage stdClass does not implement chillerlan\bbcode\Modules\BaseModuleInterface
38
	 */
39
	public function testClassLoaderDoesNotImplementException(){
40
		$options                      = new ParserOptions;
41
		$options->baseModuleInterface = stdClass::class;
42
43
		$this->parser = $this->reflectionClass->newInstanceArgs([$options]);
44
	}
45
46
	/**
47
	 * @expectedException \chillerlan\BBCode\BBCodeException
48
	 * @expectedExceptionMessage foobar does not exist
49
	 */
50
	public function testClassLoaderDoesNotExistException(){
51
		$options                      = new ParserOptions;
52
		$options->baseModuleInterface = 'foobar';
53
54
		$this->parser = $this->reflectionClass->newInstanceArgs([$options]);
55
	}
56
57
}
58