PhpSpreadsheet/unitTests/Classes/src/Chart/DataSeriesValuesTest.php

45 lines
1.2 KiB
PHP
Raw Normal View History

<?php
class DataSeriesValuesTest extends PHPUnit_Framework_TestCase
{
2015-05-17 13:00:02 +00:00
public function testSetDataType()
{
$dataTypeValues = array(
'Number',
'String'
);
2016-03-22 14:19:00 +00:00
$testInstance = new \PHPExcel\Chart\DataSeriesValues;
2015-05-17 13:00:02 +00:00
foreach ($dataTypeValues as $dataTypeValue) {
$result = $testInstance->setDataType($dataTypeValue);
2016-03-22 14:19:00 +00:00
$this->assertTrue($result instanceof \PHPExcel\Chart\DataSeriesValues);
2015-05-17 13:00:02 +00:00
}
}
public function testSetInvalidDataTypeThrowsException()
{
2016-03-22 14:19:00 +00:00
$testInstance = new \PHPExcel\Chart\DataSeriesValues;
2015-05-17 13:00:02 +00:00
try {
$result = $testInstance->setDataType('BOOLEAN');
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values');
return;
}
$this->fail('An expected exception has not been raised.');
}
public function testGetDataType()
{
$dataTypeValue = 'String';
2016-03-22 14:19:00 +00:00
$testInstance = new \PHPExcel\Chart\DataSeriesValues;
2015-05-17 13:00:02 +00:00
$setValue = $testInstance->setDataType($dataTypeValue);
$result = $testInstance->getDataType();
2015-05-17 16:34:30 +00:00
$this->assertEquals($dataTypeValue, $result);
2015-05-17 13:00:02 +00:00
}
}