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

CanvasTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testMagicCallDrawRectangle() 0 6 1
A testCreate() 0 9 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
use WideImage\WideImage;
25
use Test\WideImage_TestCase;
26
27
/**
28
 * @package Tests
29
 */
30
class CanvasTest extends WideImage_TestCase
31
{
32
	public function testCreate()
33
	{
34
		$img = WideImage::createTrueColorImage(10, 10);
35
		
36
		$canvas1 = $img->getCanvas();
37
		$this->assertInstanceOf('WideImage\\Canvas', $canvas1);
38
		
39
		$canvas2 = $img->getCanvas();
40
		$this->assertSame($canvas1, $canvas2);
41
	}
42
	
43
	public function testMagicCallDrawRectangle()
44
	{
45
		$img = WideImage::createTrueColorImage(10, 10);
46
		$canvas = $img->getCanvas();
47
		$canvas->filledRectangle(1, 1, 5, 5, $img->allocateColorAlpha(255, 0, 0, 64));
0 ignored issues
show
Bug introduced by
The method filledRectangle() does not exist on WideImage\Canvas. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

47
		$canvas->/** @scrutinizer ignore-call */ 
48
           filledRectangle(1, 1, 5, 5, $img->allocateColorAlpha(255, 0, 0, 64));
Loading history...
48
		$this->assertRGBAt($img, 3, 3, array('red' => 255, 'green' => 0, 'blue' => 0, 'alpha' => 64));
49
	}
50
}
51