PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitOrTest.php

34 lines
978 B
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering;
use PhpOffice\PhpSpreadsheet\Calculation\Exception as CalcExp;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\TestCase;
class BitOrTest extends TestCase
{
/**
* @dataProvider providerBITOR
*
* @param mixed $expectedResult
*/
public function testBITOR($expectedResult, string $formula): void
{
if ($expectedResult === 'exception') {
$this->expectException(CalcExp::class);
}
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A2', 8);
$sheet->getCell('A1')->setValue("=BITOR($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue();
self::assertEquals($expectedResult, $result);
}
public function providerBITOR(): array
{
return require 'tests/data/Calculation/Engineering/BITOR.php';
}
}