PhpSpreadsheet/unitTests/Classes/PHPExcel/Calculation/LogicalTest.php

113 lines
2.9 KiB
PHP
Raw Normal View History

2012-07-31 20:56:11 +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');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
2015-05-17 13:00:02 +00:00
public function testTRUE()
{
$result = PHPExcel_Calculation_Logical::TRUE();
$this->assertEquals(true, $result);
}
2012-07-31 20:56:11 +00:00
2015-05-17 13:00:02 +00:00
public function testFALSE()
{
$result = PHPExcel_Calculation_Logical::FALSE();
$this->assertEquals(false, $result);
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerAND
*/
2015-05-17 13:00:02 +00:00
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);
}
2012-07-31 20:56:11 +00:00
public function providerAND()
{
2015-05-17 13:00:02 +00:00
return new testDataFileIterator('rawTestData/Calculation/Logical/AND.data');
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerOR
*/
2015-05-17 13:00:02 +00:00
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);
}
2012-07-31 20:56:11 +00:00
public function providerOR()
{
2015-05-17 13:00:02 +00:00
return new testDataFileIterator('rawTestData/Calculation/Logical/OR.data');
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerNOT
*/
public function testNOT()
2015-05-17 13:00:02 +00:00
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'),$args);
$this->assertEquals($expectedResult, $result);
}
2012-07-31 20:56:11 +00:00
public function providerNOT()
{
2015-05-17 13:00:02 +00:00
return new testDataFileIterator('rawTestData/Calculation/Logical/NOT.data');
2012-07-31 20:56:11 +00:00
}
/**
* @dataProvider providerIF
*/
public function testIF()
2015-05-17 13:00:02 +00:00
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'),$args);
$this->assertEquals($expectedResult, $result);
}
2012-07-31 20:56:11 +00:00
public function providerIF()
{
2015-05-17 13:00:02 +00:00
return new testDataFileIterator('rawTestData/Calculation/Logical/IF.data');
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIFERROR
*/
public function testIFERROR()
2015-05-17 13:00:02 +00:00
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'),$args);
$this->assertEquals($expectedResult, $result);
}
2012-07-31 20:56:11 +00:00
public function providerIFERROR()
{
return new testDataFileIterator('rawTestData/Calculation/Logical/IFERROR.data');
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
}