Skip to content

Commit

Permalink
MNT Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Dec 3, 2024
1 parent bd0b067 commit c56f8fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/php/Dev/BacktraceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static function matchesFilterableClassProvider(): array
#[DataProvider('matchesFilterableClassProvider')]
public function testMatchesFilterableClass(string $className, string $filterableClass, bool $expected, string $message): void
{
$reflectionMethod = new ReflectionMethod(Backtrace::class . '::matchesFilterableClass');
$reflectionMethod = new ReflectionMethod(Backtrace::class, 'matchesFilterableClass');
$reflectionMethod->setAccessible(true);
$this->assertSame($expected, $reflectionMethod->invoke(null, $className, $filterableClass), $message);
}
Expand Down
10 changes: 5 additions & 5 deletions tests/php/Dev/CsvBulkLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function testLoad()
$filepath = $this->csvPath . 'PlayersWithHeader.csv';
$file = fopen($filepath ?? '', 'r');
$compareCount = $this->getLineCount($file);
fgetcsv($file); // pop header row
$compareRow = fgetcsv($file);
fgetcsv($file, escape: "\\"); // pop header row
$compareRow = fgetcsv($file, escape: "\\");
$results = $loader->load($filepath);

// Test that right amount of columns was imported
Expand Down Expand Up @@ -141,7 +141,7 @@ public function testLoadWithColumnMap()
$filepath = $this->csvPath . 'Players.csv';
$file = fopen($filepath ?? '', 'r');
$compareCount = $this->getLineCount($file);
$compareRow = fgetcsv($file);
$compareRow = fgetcsv($file, escape: "\\");
$loader->columnMap = [
'FirstName',
'Biography',
Expand Down Expand Up @@ -188,8 +188,8 @@ public function testLoadWithCustomHeaderAndRelation()
$filepath = $this->csvPath . 'PlayersWithCustomHeaderAndRelation.csv';
$file = fopen($filepath ?? '', 'r');
$compareCount = $this->getLineCount($file);
fgetcsv($file); // pop header row
$compareRow = fgetcsv($file);
fgetcsv($file, escape: "\\"); // pop header row
$compareRow = fgetcsv($file, escape: "\\");
$loader->columnMap = [
'first name' => 'FirstName',
'bio' => 'Biography',
Expand Down
6 changes: 1 addition & 5 deletions tests/php/Dev/SapphireTestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use SilverStripe\Security\Permission;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\DataProviderExternal;
use SilverStripe\Dev\Exceptions\ExpectedErrorException;
use SilverStripe\Dev\Exceptions\ExpectedNoticeException;
use SilverStripe\Dev\Exceptions\ExpectedWarningException;

Expand Down Expand Up @@ -271,11 +270,8 @@ public function testEnableErrorHandler(int $errno, ?string $expectedClass): void
public static function provideEnableErrorHandler(): array
{
// Only E_USER_* errors can be triggered, so that's all that's being tested
// As of PHP 8.4, E_USER_ERROR can no longer be triggered without a PHP deprecation notice
return [
'error' => [
'errno' => E_USER_ERROR,
'expectedClass' => ExpectedErrorException::class,
],
'notice' => [
'errno' => E_USER_NOTICE,
'expectedClass' => ExpectedNoticeException::class,
Expand Down

0 comments on commit c56f8fc

Please sign in to comment.