2012-01-19 22:32:58 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
require_once 'testDataFileIterator.php';
|
|
|
|
|
|
|
|
class LogicalTest extends PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
if (!defined('PHPEXCEL_ROOT'))
|
|
|
|
{
|
|
|
|
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
|
|
|
}
|
|
|
|
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testTRUE()
|
|
|
|
{
|
|
|
|
$result = PHPExcel_Calculation_Logical::TRUE();
|
|
|
|
$this->assertEquals(TRUE, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testFALSE()
|
|
|
|
{
|
|
|
|
$result = PHPExcel_Calculation_Logical::FALSE();
|
|
|
|
$this->assertEquals(FALSE, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerAND
|
|
|
|
*/
|
|
|
|
public function testAND()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
|
|
|
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_AND'),$args);
|
|
|
|
$this->assertEquals($expectedResult, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function providerAND()
|
|
|
|
{
|
2012-01-23 23:38:58 +00:00
|
|
|
return new testDataFileIterator('rawTestData/Calculation/Logical/AND.data');
|
2012-01-19 22:32:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerOR
|
|
|
|
*/
|
|
|
|
public function testOR()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
|
|
|
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_OR'),$args);
|
|
|
|
$this->assertEquals($expectedResult, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function providerOR()
|
|
|
|
{
|
2012-01-23 23:38:58 +00:00
|
|
|
return new testDataFileIterator('rawTestData/Calculation/Logical/OR.data');
|
2012-01-19 22:32:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerNOT
|
|
|
|
*/
|
|
|
|
public function testNOT()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
|
|
|
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'),$args);
|
|
|
|
$this->assertEquals($expectedResult, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function providerNOT()
|
|
|
|
{
|
|
|
|
return new testDataFileIterator('rawTestData/Calculation/Logical/NOT.data');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerIF
|
|
|
|
*/
|
|
|
|
public function testIF()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
|
|
|
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'),$args);
|
|
|
|
$this->assertEquals($expectedResult, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function providerIF()
|
|
|
|
{
|
2012-01-23 23:38:58 +00:00
|
|
|
return new testDataFileIterator('rawTestData/Calculation/Logical/IF.data');
|
2012-01-19 22:32:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerIFERROR
|
|
|
|
*/
|
|
|
|
public function testIFERROR()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
|
|
|
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'),$args);
|
|
|
|
$this->assertEquals($expectedResult, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function providerIFERROR()
|
|
|
|
{
|
2012-01-23 23:38:58 +00:00
|
|
|
return new testDataFileIterator('rawTestData/Calculation/Logical/IFERROR.data');
|
2012-01-19 22:32:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|