mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-23 00:30:09 +00:00
ec4098c8fd
While we might never be able to have 100% of our code strict, we can at the very least do it for all of our tests. This ensures that our tests are using our API with the types as intended by the test author, and not silently be cast to what our API requires.
33 lines
1.7 KiB
PHP
33 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Logical;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Logical;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
// Sanity tests for functions which have been moved out of Functions
|
|
// to their own classes. A deprecated version remains in Functions;
|
|
// this class contains cursory tests to ensure that those work properly.
|
|
// If Scrutinizer fails the PR because of these deprecations, I will
|
|
// remove this class from the PR.
|
|
|
|
class DeprecatedFunctionsTest extends TestCase
|
|
{
|
|
public function testDeprecated(): void
|
|
{
|
|
self::assertFalse(/** @scrutinizer ignore-deprecated */ Logical::false());
|
|
self::assertFalse(/** @scrutinizer ignore-deprecated */ Logical::logicalAnd(true, false));
|
|
self::assertTrue(/** @scrutinizer ignore-deprecated */ Logical::NOT(false));
|
|
self::assertTrue(/** @scrutinizer ignore-deprecated */ Logical::logicalOr(true, false));
|
|
self::assertTrue(/** @scrutinizer ignore-deprecated */ Logical::logicalXor(true, false));
|
|
self::assertTrue(/** @scrutinizer ignore-deprecated */ Logical::true());
|
|
self::assertFalse(/** @scrutinizer ignore-deprecated */ Logical::statementIf(false));
|
|
self::assertSame('error', /** @scrutinizer ignore-deprecated */ Logical::IFERROR('#VALUE!', 'error'));
|
|
self::assertSame('#VALUE!', /** @scrutinizer ignore-deprecated */ Logical::IFNA('#VALUE!', 'error'));
|
|
self::assertSame('two', /** @scrutinizer ignore-deprecated */ Logical::IFS(false, 'one', true, 'two', true, 'three'));
|
|
self::assertSame(31, /** @scrutinizer ignore-deprecated */ Logical::statementSwitch(30, 10, 11, 20, 21, 30, 31, 40, 41));
|
|
}
|
|
}
|