diff --git a/tests/phpunit/includes/libs/serialization/SerializationTestUtils.php b/tests/phpunit/includes/libs/serialization/SerializationTestUtils.php index 9a01cf43c3a..4e2274f52de 100644 --- a/tests/phpunit/includes/libs/serialization/SerializationTestUtils.php +++ b/tests/phpunit/includes/libs/serialization/SerializationTestUtils.php @@ -62,6 +62,9 @@ class SerializationTestUtils { callable $serializer, callable $deserializer ) { + if ( !is_dir( $serializedDataPath ) ) { + throw new InvalidArgumentException( "{$serializedDataPath} does not exist" ); + } $this->serializedDataPath = $serializedDataPath; $this->ext = $ext; $this->serializer = $serializer; diff --git a/tests/phpunit/unit/includes/libs/GhostFieldAccessTraitTest.php b/tests/phpunit/unit/includes/libs/GhostFieldAccessTraitTest.php index 8167a113611..213d43d31a5 100644 --- a/tests/phpunit/unit/includes/libs/GhostFieldAccessTraitTest.php +++ b/tests/phpunit/unit/includes/libs/GhostFieldAccessTraitTest.php @@ -12,23 +12,14 @@ use Wikimedia\Tests\SerializationTestUtils; */ class GhostFieldAccessTraitTest extends MediaWikiUnitTestCase { - private $serializationTestUtils; - protected function setUp() : void { parent::setUp(); - // Not using the trait since we only need deserialization tests. - $this->serializationTestUtils = new SerializationTestUtils( - __DIR__ . '/../../data/GhostFieldAccess', - [], - 'serialized', - 'serialize', - 'unserialize' - ); } private function provideUnserializedInstances( string $testCaseName ) { + // Not using the trait since we only need deserialization tests. $serializationTestUtils = new SerializationTestUtils( - __DIR__ . '/../../data/GhostFieldAccess', + __DIR__ . '/../../../data/GhostFieldAccess', [], 'serialized', 'serialize',