mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-24 06:38:27 +00:00
5d1ab39def
Replace mock tests with real ones when possible. The original tests are all still present; they just take place in a more representative scenario. After this, there will be 4 remaining uses of mocking. Of these, 3 are needed for scenarios which are otherwise hard to test - WebServiceTest, CellsTest, and SampleCoverageTest. For the other one, AutoFilterTest, I just can't figure out what it's trying to accomplish, so have left it alone. This change is almost entirely restricted to tests. There is a one-line change in src. When the first argument passed to OFFSET is null or nullstring, the returned value is currently 0. However, according to the documentation for Excel, it should be `#VALUE!`. The code is changed accordingly.
33 lines
829 B
PHP
33 lines
829 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class TransposeTest extends TestCase
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerTRANSPOSE
|
|
*
|
|
* @param mixed $expectedResult
|
|
* @param mixed $matrix
|
|
*/
|
|
public function testTRANSPOSE($expectedResult, $matrix): void
|
|
{
|
|
$result = LookupRef\Matrix::transpose($matrix);
|
|
self::assertEquals($expectedResult, $result);
|
|
}
|
|
|
|
public function providerTRANSPOSE(): array
|
|
{
|
|
return require 'tests/data/Calculation/LookupRef/TRANSPOSE.php';
|
|
}
|
|
}
|