PhpSpreadsheet/tests/PhpSpreadsheetTests/Cell/CellTest.php
Adrien Crivelli e868e58d20
Allow to run an entire folder of tests
We now can do something like:

```sh
./vendor/bin/phpunit tests/PhpSpreadsheetTests/Reader/
```
2020-05-17 18:35:55 +09:00

53 lines
1.4 KiB
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Cell;
use PhpOffice\PhpSpreadsheet\Exception;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\TestCase;
class CellTest extends TestCase
{
/**
* @dataProvider providerSetValueExplicit
*
* @param mixed $expected
* @param mixed $value
* @param string $dataType
*/
public function testSetValueExplicit($expected, $value, string $dataType)
{
$spreadsheet = new Spreadsheet();
$cell = $spreadsheet->getActiveSheet()->getCell('A1');
$cell->setValueExplicit($value, $dataType);
self::assertSame($expected, $cell->getValue());
}
public function providerSetValueExplicit()
{
return require 'tests/data/Cell/SetValueExplicit.php';
}
/**
* @dataProvider providerSetValueExplicitException
*
* @param mixed $expected
* @param mixed $value
* @param string $dataType
*/
public function testSetValueExplicitException($value, string $dataType)
{
$this->expectException(Exception::class);
$spreadsheet = new Spreadsheet();
$cell = $spreadsheet->getActiveSheet()->getCell('A1');
$cell->setValueExplicit($value, $dataType);
}
public function providerSetValueExplicitException()
{
return require 'tests/data/Cell/SetValueExplicitException.php';
}
}