PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/LogicalTest.php

107 lines
2.4 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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testAND($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Logical::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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testOR($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Logical::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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testNOT($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Logical::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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testIF($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Logical::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
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testIFERROR($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Logical::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
}