ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
LegendTest.php
Go to the documentation of this file.
1<?php
2
3
5{
6
7 public function setUp()
8 {
9 if (!defined('PHPEXCEL_ROOT'))
10 {
11 define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
12 }
13 require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
14 }
15
16 public function testSetPosition()
17 {
18 $positionValues = array(
24 );
25
26 $testInstance = new PHPExcel_Chart_Legend;
27
28 foreach($positionValues as $positionValue) {
29 $result = $testInstance->setPosition($positionValue);
30 $this->assertTrue($result);
31 }
32 }
33
35 {
36 $testInstance = new PHPExcel_Chart_Legend;
37
38 $result = $testInstance->setPosition('BottomLeft');
39 $this->assertFalse($result);
40 // Ensure that value is unchanged
41 $result = $testInstance->getPosition();
43 }
44
45 public function testGetPosition()
46 {
48
49 $testInstance = new PHPExcel_Chart_Legend;
50 $setValue = $testInstance->setPosition($PositionValue);
51
52 $result = $testInstance->getPosition();
53 $this->assertEquals($PositionValue,$result);
54 }
55
56 public function testSetPositionXL()
57 {
58 $positionValues = array(
65 );
66
67 $testInstance = new PHPExcel_Chart_Legend;
68
69 foreach($positionValues as $positionValue) {
70 $result = $testInstance->setPositionXL($positionValue);
71 $this->assertTrue($result);
72 }
73 }
74
76 {
77 $testInstance = new PHPExcel_Chart_Legend;
78
79 $result = $testInstance->setPositionXL(999);
80 $this->assertFalse($result);
81 // Ensure that value is unchanged
82 $result = $testInstance->getPositionXL();
84 }
85
86 public function testGetPositionXL()
87 {
89
90 $testInstance = new PHPExcel_Chart_Legend;
91 $setValue = $testInstance->setPositionXL($PositionValue);
92
93 $result = $testInstance->getPositionXL();
94 $this->assertEquals($PositionValue,$result);
95 }
96
97 public function testSetOverlay()
98 {
99 $overlayValues = array(
100 TRUE,
101 FALSE,
102 );
103
104 $testInstance = new PHPExcel_Chart_Legend;
105
106 foreach($overlayValues as $overlayValue) {
107 $result = $testInstance->setOverlay($overlayValue);
108 $this->assertTrue($result);
109 }
110 }
111
113 {
114 $testInstance = new PHPExcel_Chart_Legend;
115
116 $result = $testInstance->setOverlay('INVALID');
117 $this->assertFalse($result);
118
119 $result = $testInstance->getOverlay();
120 $this->assertFalse($result);
121 }
122
123 public function testGetOverlay()
124 {
125 $OverlayValue = TRUE;
126
127 $testInstance = new PHPExcel_Chart_Legend;
128 $setValue = $testInstance->setOverlay($OverlayValue);
129
130 $result = $testInstance->getOverlay();
131 $this->assertEquals($OverlayValue,$result);
132 }
133
134}
$result
An exception for terminatinating execution or to throw for unit testing.
testSetPosition()
Definition: LegendTest.php:16
testSetInvalidOverlayReturnsFalse()
Definition: LegendTest.php:112
testSetInvalidPositionReturnsFalse()
Definition: LegendTest.php:34
testSetInvalidXLPositionReturnsFalse()
Definition: LegendTest.php:75
testGetPosition()
Definition: LegendTest.php:45
testSetPositionXL()
Definition: LegendTest.php:56
testGetPositionXL()
Definition: LegendTest.php:86
testSetOverlay()
Definition: LegendTest.php:97
const xlLegendPositionCorner
Definition: Legend.php:40
const POSITION_TOPRIGHT
Definition: Legend.php:50
const xlLegendPositionTop
Definition: Legend.php:44
const xlLegendPositionLeft
Definition: Legend.php:42
setPosition($position=self::POSITION_RIGHT)
Get legend position using an excel string value.
Definition: Legend.php:106
setPositionXL($positionXL=self::xlLegendPositionRight)
Set legend position using an Excel internal numeric value.
Definition: Legend.php:129
const xlLegendPositionRight
Definition: Legend.php:43
const xlLegendPositionBottom
Legend positions.
Definition: Legend.php:39
const xlLegendPositionCustom
Definition: Legend.php:41
setOverlay($overlay=FALSE)
Set allow overlay of other elements?
Definition: Legend.php:153
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27