Passed
Push — master ( 3c6756...8b3b37 )
by Michael
20:43 queued 12:59
created

OperationFactoryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 21
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testNoOperation() 0 3 1
A testFactoryReturnsCached() 0 5 1
A testUserDefinedOp() 0 4 1
1
<?php
2
	/**
3
    This file is part of WideImage.
4
		
5
    WideImage is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU Lesser General Public License as published by
7
    the Free Software Foundation; either version 2.1 of the License, or
8
    (at your option) any later version.
9
		
10
    WideImage is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU Lesser General Public License for more details.
14
		
15
    You should have received a copy of the GNU Lesser General Public License
16
    along with WideImage; if not, write to the Free Software
17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
    
19
    * @package Tests
20
  **/
21
22
namespace Test\WideImage;
23
24
include_once __DIR__ . '/Operation/MyOperation.php';
25
26
use WideImage\OperationFactory;
27
use WideImage\Operation\MyOperation;
28
use Test\WideImage_TestCase;
29
30
/**
31
 * @package Tests
32
 */
33
class OperationFactoryTest extends WideImage_TestCase
34
{
35
	public function testFactoryReturnsCached()
36
	{
37
		$op1 = OperationFactory::get('Mirror');
38
		$op2 = OperationFactory::get('Mirror');
39
		$this->assertSame($op1, $op2);
40
	}
41
	
42
	/**
43
	 * @expectedException WideImage\Exception\UnknownImageOperationException
44
	 */
45
	public function testNoOperation()
46
	{
47
		$op = OperationFactory::get('NoSuchOp');
0 ignored issues
show
Unused Code introduced by
The assignment to $op is dead and can be removed.
Loading history...
48
	}
49
	
50
	public function testUserDefinedOp()
51
	{
52
		$op = OperationFactory::get('MyOperation');
53
		$this->assertTrue($op instanceof MyOperation);
54
	}
55
}
56