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

ClassLoaderTraitTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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