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