diff --git a/tests/php/Dev/BacktraceTest.php b/tests/php/Dev/BacktraceTest.php index 2435ab5c8b4..682c12018ec 100644 --- a/tests/php/Dev/BacktraceTest.php +++ b/tests/php/Dev/BacktraceTest.php @@ -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); } diff --git a/tests/php/Dev/CsvBulkLoaderTest.php b/tests/php/Dev/CsvBulkLoaderTest.php index 8f5d84834c4..8d1a5fb69db 100644 --- a/tests/php/Dev/CsvBulkLoaderTest.php +++ b/tests/php/Dev/CsvBulkLoaderTest.php @@ -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 @@ -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', @@ -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', diff --git a/tests/php/Dev/SapphireTestTest.php b/tests/php/Dev/SapphireTestTest.php index cee251278ab..7074dd52dd9 100644 --- a/tests/php/Dev/SapphireTestTest.php +++ b/tests/php/Dev/SapphireTestTest.php @@ -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; @@ -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, diff --git a/tests/php/Forms/FormFieldTest.php b/tests/php/Forms/FormFieldTest.php index 0611999e6e0..cab62ddccee 100644 --- a/tests/php/Forms/FormFieldTest.php +++ b/tests/php/Forms/FormFieldTest.php @@ -93,7 +93,6 @@ use SilverStripe\Core\Validation\FieldValidation\OptionFieldValidator; use SilverStripe\ORM\DataList; use SilverStripe\Forms\DropdownField; -use SilverStripe\Forms\SegmentField; use SilverStripe\Core\Validation\FieldValidation\TimeFieldValidator; use SilverStripe\Core\Validation\FieldValidation\DatetimeFieldValidator; @@ -932,9 +931,6 @@ public function testFieldValidatorConfig(): void SelectionGroup_Item::class => [ CompositeFieldValidator::class, ], - SegmentField::class => [ - StringFieldValidator::class, - ], SingleLookupField::class => [], Tab::class => [ CompositeFieldValidator::class, @@ -969,6 +965,12 @@ public function testFieldValidatorConfig(): void ]; $count = 0; foreach ($this->getFormFieldClasses() as $class) { + // skip any class with a core namespace that resides in an optional module that + // is included in silverstripe/recipe-kitchen-sink, and not in silverstripe/installer + if ($class === 'SilverStripe\\Forms\\SegmentField') { + // class if from silverstripe/segment-field + continue; + } if (!array_key_exists($class, $expectedFieldValidators)) { throw new Exception("No field validator config found for $class"); } @@ -983,7 +985,7 @@ public function testFieldValidatorConfig(): void } // Assert that we have tested all classes e.g. namespace wasn't changed, no new classes were added // that haven't been tested - $this->assertSame(58, $count); + $this->assertSame(57, $count); } private function instantiateFormField(string $class): FormField