ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ColumnTest.php
Go to the documentation of this file.
1 <?php
2 
3 
5 {
6  private $_testInitialColumn = 'H';
7 
9 
11 
12  public function setUp()
13  {
14  if (!defined('PHPEXCEL_ROOT')) {
15  define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
16  }
17  require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
18 
19  $this->_mockAutoFilterObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter')
20  ->disableOriginalConstructor()
21  ->getMock();
22 
23  $this->_mockAutoFilterObject->expects($this->any())
24  ->method('testColumnInRange')
25  ->will($this->returnValue(3));
26 
27  $this->_testAutoFilterColumnObject = new PHPExcel_Worksheet_AutoFilter_Column(
28  $this->_testInitialColumn,
29  $this->_mockAutoFilterObject
30  );
31  }
32 
33  public function testGetColumnIndex()
34  {
35  $result = $this->_testAutoFilterColumnObject->getColumnIndex();
36  $this->assertEquals($this->_testInitialColumn, $result);
37  }
38 
39  public function testSetColumnIndex()
40  {
41  $expectedResult = 'L';
42 
43  // Setters return the instance to implement the fluent interface
44  $result = $this->_testAutoFilterColumnObject->setColumnIndex($expectedResult);
45  $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
46 
47  $result = $this->_testAutoFilterColumnObject->getColumnIndex();
48  $this->assertEquals($expectedResult, $result);
49  }
50 
51  public function testGetParent()
52  {
53  $result = $this->_testAutoFilterColumnObject->getParent();
54  $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
55  }
56 
57  public function testSetParent()
58  {
59  // Setters return the instance to implement the fluent interface
60  $result = $this->_testAutoFilterColumnObject->setParent($this->_mockAutoFilterObject);
61  $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
62  }
63 
64  public function testGetFilterType()
65  {
66  $result = $this->_testAutoFilterColumnObject->getFilterType();
68  }
69 
70  public function testSetFilterType()
71  {
72  $result = $this->_testAutoFilterColumnObject->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
73  $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
74 
75  $result = $this->_testAutoFilterColumnObject->getFilterType();
77  }
78 
83  {
84  $expectedResult = 'Unfiltered';
85 
86  $result = $this->_testAutoFilterColumnObject->setFilterType($expectedResult);
87  }
88 
89  public function testGetJoin()
90  {
91  $result = $this->_testAutoFilterColumnObject->getJoin();
93  }
94 
95  public function testSetJoin()
96  {
97  $result = $this->_testAutoFilterColumnObject->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
98  $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
99 
100  $result = $this->_testAutoFilterColumnObject->getJoin();
102  }
103 
108  {
109  $expectedResult = 'Neither';
110 
111  $result = $this->_testAutoFilterColumnObject->setJoin($expectedResult);
112  }
113 
114  public function testSetAttributes()
115  {
116  $attributeSet = array( 'val' => 100,
117  'maxVal' => 200
118  );
119 
120  // Setters return the instance to implement the fluent interface
121  $result = $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
122  $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
123  }
124 
125  public function testGetAttributes()
126  {
127  $attributeSet = array( 'val' => 100,
128  'maxVal' => 200
129  );
130 
131  $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
132 
133  $result = $this->_testAutoFilterColumnObject->getAttributes();
134  $this->assertTrue(is_array($result));
135  $this->assertEquals(count($attributeSet), count($result));
136  }
137 
138  public function testSetAttribute()
139  {
140  $attributeSet = array( 'val' => 100,
141  'maxVal' => 200
142  );
143 
144  foreach($attributeSet as $attributeName => $attributeValue) {
145  // Setters return the instance to implement the fluent interface
146  $result = $this->_testAutoFilterColumnObject->setAttribute($attributeName,$attributeValue);
147  $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
148  }
149  }
150 
151  public function testGetAttribute()
152  {
153  $attributeSet = array( 'val' => 100,
154  'maxVal' => 200
155  );
156 
157  $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
158 
159  foreach($attributeSet as $attributeName => $attributeValue) {
160  $result = $this->_testAutoFilterColumnObject->getAttribute($attributeName);
161  $this->assertEquals($attributeValue, $result);
162  }
163  $result = $this->_testAutoFilterColumnObject->getAttribute('nonExistentAttribute');
164  $this->assertNull($result);
165  }
166 
167  public function testClone()
168  {
170  $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
171  }
172 
173 }
$result
testSetInvalidFilterTypeThrowsException()
PHPExcel_Exception
Definition: ColumnTest.php:82
testSetInvalidJoinThrowsException()
PHPExcel_Exception
Definition: ColumnTest.php:107
Create styles array
The data for the language used.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27