Migrate away from deprecated PHPUnit asserts
This commit is contained in:
parent
b2070fd181
commit
fa54ca79a3
|
@ -52,7 +52,7 @@ class CalculationTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function testGetFunctions($category, $functionCall, $argumentCount)
|
public function testGetFunctions($category, $functionCall, $argumentCount)
|
||||||
{
|
{
|
||||||
self::assertInternalType('callable', $functionCall);
|
self::assertIsCallable($functionCall);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providerGetFunctions()
|
public function providerGetFunctions()
|
||||||
|
|
|
@ -970,25 +970,25 @@ class EngineeringTest extends TestCase
|
||||||
public function testGetConversionGroups()
|
public function testGetConversionGroups()
|
||||||
{
|
{
|
||||||
$result = Engineering::getConversionGroups();
|
$result = Engineering::getConversionGroups();
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetConversionGroupUnits()
|
public function testGetConversionGroupUnits()
|
||||||
{
|
{
|
||||||
$result = Engineering::getConversionGroupUnits();
|
$result = Engineering::getConversionGroupUnits();
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetConversionGroupUnitDetails()
|
public function testGetConversionGroupUnitDetails()
|
||||||
{
|
{
|
||||||
$result = Engineering::getConversionGroupUnitDetails();
|
$result = Engineering::getConversionGroupUnitDetails();
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetConversionMultipliers()
|
public function testGetConversionMultipliers()
|
||||||
{
|
{
|
||||||
$result = Engineering::getConversionMultipliers();
|
$result = Engineering::getConversionMultipliers();
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,7 +49,7 @@ class DateTest extends TestCase
|
||||||
|
|
||||||
$result = DateTime::DATE(2012, 1, 31);
|
$result = DateTime::DATE(2012, 1, 31);
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
$this->assertInternalType('object', $result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
||||||
// ... with the correct value
|
// ... with the correct value
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\DateTime;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\DateTime;
|
||||||
|
|
||||||
|
use DateTimeInterface;
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\DateTime;
|
use PhpOffice\PhpSpreadsheet\Calculation\DateTime;
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||||
|
@ -47,9 +48,9 @@ class DateValueTest extends TestCase
|
||||||
|
|
||||||
$result = DateTime::DATEVALUE('2012-1-31');
|
$result = DateTime::DATEVALUE('2012-1-31');
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
$this->assertInternalType('object', $result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
$this->assertTrue(is_a($result, DateTimeInterface::class));
|
||||||
// ... with the correct value
|
// ... with the correct value
|
||||||
$this->assertEquals($result->format('d-M-Y'), '31-Jan-2012');
|
$this->assertEquals($result->format('d-M-Y'), '31-Jan-2012');
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class EDateTest extends TestCase
|
||||||
|
|
||||||
$result = DateTime::EDATE('2012-1-26', -1);
|
$result = DateTime::EDATE('2012-1-26', -1);
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
$this->assertInternalType('object', $result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
||||||
// ... with the correct value
|
// ... with the correct value
|
||||||
|
|
|
@ -48,7 +48,7 @@ class EoMonthTest extends TestCase
|
||||||
|
|
||||||
$result = DateTime::EOMONTH('2012-1-26', -1);
|
$result = DateTime::EOMONTH('2012-1-26', -1);
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
$this->assertInternalType('object', $result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
||||||
// ... with the correct value
|
// ... with the correct value
|
||||||
|
|
|
@ -46,7 +46,7 @@ class TimeTest extends TestCase
|
||||||
|
|
||||||
$result = DateTime::TIME(7, 30, 20);
|
$result = DateTime::TIME(7, 30, 20);
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
$this->assertInternalType('object', $result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
||||||
// ... with the correct value
|
// ... with the correct value
|
||||||
|
|
|
@ -46,7 +46,7 @@ class TimeValueTest extends TestCase
|
||||||
|
|
||||||
$result = DateTime::TIMEVALUE('7:30:20');
|
$result = DateTime::TIMEVALUE('7:30:20');
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
$this->assertInternalType('object', $result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
$this->assertTrue(is_a($result, 'DateTimeInterface'));
|
||||||
// ... with the correct value
|
// ... with the correct value
|
||||||
|
|
|
@ -10,7 +10,7 @@ class DataTypeTest extends TestCase
|
||||||
public function testGetErrorCodes()
|
public function testGetErrorCodes()
|
||||||
{
|
{
|
||||||
$result = DataType::getErrorCodes();
|
$result = DataType::getErrorCodes();
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
self::assertGreaterThan(0, count($result));
|
self::assertGreaterThan(0, count($result));
|
||||||
self::assertArrayHasKey('#NULL!', $result);
|
self::assertArrayHasKey('#NULL!', $result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,28 +240,28 @@ class OdsTest extends TestCase
|
||||||
|
|
||||||
$properties = $spreadsheet->getProperties();
|
$properties = $spreadsheet->getProperties();
|
||||||
// Core Properties
|
// Core Properties
|
||||||
// $this->assertSame('Mark Baker', $properties->getCreator());
|
// self::assertSame('Mark Baker', $properties->getCreator());
|
||||||
$this->assertSame('Property Test File', $properties->getTitle());
|
self::assertSame('Property Test File', $properties->getTitle());
|
||||||
$this->assertSame('Testing for Properties', $properties->getSubject());
|
self::assertSame('Testing for Properties', $properties->getSubject());
|
||||||
$this->assertSame('TEST ODS PHPSpreadsheet', $properties->getKeywords());
|
self::assertSame('TEST ODS PHPSpreadsheet', $properties->getKeywords());
|
||||||
|
|
||||||
// Extended Properties
|
// Extended Properties
|
||||||
// $this->assertSame('PHPOffice', $properties->getCompany());
|
// self::assertSame('PHPOffice', $properties->getCompany());
|
||||||
// $this->assertSame('The Big Boss', $properties->getManager());
|
// self::assertSame('The Big Boss', $properties->getManager());
|
||||||
|
|
||||||
// Custom Properties
|
// Custom Properties
|
||||||
$customProperties = $properties->getCustomProperties();
|
$customProperties = $properties->getCustomProperties();
|
||||||
$this->assertInternalType('array', $customProperties);
|
self::assertIsArray($customProperties);
|
||||||
$customProperties = array_flip($customProperties);
|
$customProperties = array_flip($customProperties);
|
||||||
$this->assertArrayHasKey('TestDate', $customProperties);
|
self::assertArrayHasKey('TestDate', $customProperties);
|
||||||
|
|
||||||
foreach ($customPropertySet as $propertyName => $testData) {
|
foreach ($customPropertySet as $propertyName => $testData) {
|
||||||
$this->assertTrue($properties->isCustomPropertySet($propertyName));
|
self::assertTrue($properties->isCustomPropertySet($propertyName));
|
||||||
$this->assertSame($testData['type'], $properties->getCustomPropertyType($propertyName));
|
self::assertSame($testData['type'], $properties->getCustomPropertyType($propertyName));
|
||||||
if ($properties->getCustomPropertyType($propertyName) == Properties::PROPERTY_TYPE_DATE) {
|
if ($properties->getCustomPropertyType($propertyName) == Properties::PROPERTY_TYPE_DATE) {
|
||||||
$this->assertSame($testData['value'], date('Y-m-d', $properties->getCustomPropertyValue($propertyName)));
|
self::assertSame($testData['value'], date('Y-m-d', $properties->getCustomPropertyValue($propertyName)));
|
||||||
} else {
|
} else {
|
||||||
$this->assertSame($testData['value'], $properties->getCustomPropertyValue($propertyName));
|
self::assertSame($testData['value'], $properties->getCustomPropertyValue($propertyName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ class XmlScannerTest extends TestCase
|
||||||
$scanner = $fileReader->getSecurityScanner();
|
$scanner = $fileReader->getSecurityScanner();
|
||||||
|
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
$this->assertInternalType('object', $scanner);
|
self::assertIsObject($scanner);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
$this->assertInstanceOf(XmlScanner::class, $scanner);
|
$this->assertInstanceOf(XmlScanner::class, $scanner);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class XlsxTest extends TestCase
|
||||||
|
|
||||||
// Custom Properties
|
// Custom Properties
|
||||||
$customProperties = $properties->getCustomProperties();
|
$customProperties = $properties->getCustomProperties();
|
||||||
$this->assertInternalType('array', $customProperties);
|
self::assertIsArray($customProperties);
|
||||||
$customProperties = array_flip($customProperties);
|
$customProperties = array_flip($customProperties);
|
||||||
$this->assertArrayHasKey('Publisher', $customProperties);
|
$this->assertArrayHasKey('Publisher', $customProperties);
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ class ColumnTest extends TestCase
|
||||||
$this->testAutoFilterColumnObject->setAttributes($attributeSet);
|
$this->testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||||
|
|
||||||
$result = $this->testAutoFilterColumnObject->getAttributes();
|
$result = $this->testAutoFilterColumnObject->getAttributes();
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
self::assertCount(count($attributeSet), $result);
|
self::assertCount(count($attributeSet), $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ class AutoFilterTest extends TestCase
|
||||||
{
|
{
|
||||||
// There should be no columns yet defined
|
// There should be no columns yet defined
|
||||||
$result = $this->testAutoFilterObject->getColumns();
|
$result = $this->testAutoFilterObject->getColumns();
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
self::assertCount(0, $result);
|
self::assertCount(0, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ class AutoFilterTest extends TestCase
|
||||||
$result = $this->testAutoFilterObject->getColumns();
|
$result = $this->testAutoFilterObject->getColumns();
|
||||||
// Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column
|
// Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column
|
||||||
// objects for each column we set indexed by the column ID
|
// objects for each column we set indexed by the column ID
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
self::assertCount(1, $result);
|
self::assertCount(1, $result);
|
||||||
self::assertArrayHasKey($expectedResult, $result);
|
self::assertArrayHasKey($expectedResult, $result);
|
||||||
self::assertInstanceOf(Column::class, $result[$expectedResult]);
|
self::assertInstanceOf(Column::class, $result[$expectedResult]);
|
||||||
|
@ -178,7 +178,7 @@ class AutoFilterTest extends TestCase
|
||||||
$result = $this->testAutoFilterObject->getColumns();
|
$result = $this->testAutoFilterObject->getColumns();
|
||||||
// Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column
|
// Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column
|
||||||
// objects for each column we set indexed by the column ID
|
// objects for each column we set indexed by the column ID
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
self::assertCount(1, $result);
|
self::assertCount(1, $result);
|
||||||
self::assertArrayHasKey($expectedResult, $result);
|
self::assertArrayHasKey($expectedResult, $result);
|
||||||
self::assertInstanceOf(Column::class, $result[$expectedResult]);
|
self::assertInstanceOf(Column::class, $result[$expectedResult]);
|
||||||
|
@ -211,7 +211,7 @@ class AutoFilterTest extends TestCase
|
||||||
$result = $this->testAutoFilterObject->getColumns();
|
$result = $this->testAutoFilterObject->getColumns();
|
||||||
// Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column
|
// Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column
|
||||||
// objects for each column we set indexed by the column ID
|
// objects for each column we set indexed by the column ID
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
self::assertCount(count($columnIndexes), $result);
|
self::assertCount(count($columnIndexes), $result);
|
||||||
foreach ($columnIndexes as $columnIndex) {
|
foreach ($columnIndexes as $columnIndex) {
|
||||||
self::assertArrayHasKey($columnIndex, $result);
|
self::assertArrayHasKey($columnIndex, $result);
|
||||||
|
@ -288,7 +288,7 @@ class AutoFilterTest extends TestCase
|
||||||
|
|
||||||
// Column array should be cleared
|
// Column array should be cleared
|
||||||
$result = $this->testAutoFilterObject->getColumns();
|
$result = $this->testAutoFilterObject->getColumns();
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
self::assertCount(0, $result);
|
self::assertCount(0, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ class AutoFilterTest extends TestCase
|
||||||
// Only columns that existed in the original range and that
|
// Only columns that existed in the original range and that
|
||||||
// still fall within the new range should be retained
|
// still fall within the new range should be retained
|
||||||
$result = $this->testAutoFilterObject->getColumns();
|
$result = $this->testAutoFilterObject->getColumns();
|
||||||
self::assertInternalType('array', $result);
|
self::assertIsArray($result);
|
||||||
self::assertCount(count($columnIndexes1), $result);
|
self::assertCount(count($columnIndexes1), $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue