PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/LogicalTest.php

107 lines
2.5 KiB
PHP
Raw Normal View History

2012-07-31 20:56:11 +00:00
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
2012-07-31 20:56:11 +00:00
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Logical;
2016-03-22 14:35:50 +00:00
class LogicalTest extends \PHPUnit_Framework_TestCase
2012-07-31 20:56:11 +00:00
{
public function setUp()
{
Functions::setCompatibilityMode(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 = Logical::TRUE();
$this->assertTrue($result);
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 testFALSE()
{
$result = Logical::FALSE();
$this->assertFalse($result);
2015-05-17 13:00:02 +00:00
}
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([Logical::class, 'logicalAnd'], $args);
2015-05-17 13:00:02 +00:00
$this->assertEquals($expectedResult, $result);
}
2012-07-31 20:56:11 +00:00
public function providerAND()
{
return require 'data/Calculation/Logical/AND.php';
2015-05-17 13:00:02 +00:00
}
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([Logical::class, 'logicalOr'], $args);
2015-05-17 13:00:02 +00:00
$this->assertEquals($expectedResult, $result);
}
2012-07-31 20:56:11 +00:00
public function providerOR()
{
return require 'data/Calculation/Logical/OR.php';
2015-05-17 13:00:02 +00:00
}
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([Logical::class, 'NOT'], $args);
2015-05-17 13:00:02 +00:00
$this->assertEquals($expectedResult, $result);
}
2012-07-31 20:56:11 +00:00
public function providerNOT()
{
return require 'data/Calculation/Logical/NOT.php';
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([Logical::class, 'statementIf'], $args);
2015-05-17 13:00:02 +00:00
$this->assertEquals($expectedResult, $result);
}
2012-07-31 20:56:11 +00:00
public function providerIF()
{
return require 'data/Calculation/Logical/IF.php';
2015-05-17 13:00:02 +00:00
}
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([Logical::class, 'IFERROR'], $args);
2015-05-17 13:00:02 +00:00
$this->assertEquals($expectedResult, $result);
}
2012-07-31 20:56:11 +00:00
public function providerIFERROR()
{
return require 'data/Calculation/Logical/IFERROR.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
}