Fix GhostFieldAccessTrait tests

Change-Id: Id03febbcb9d250a649eb03006f4984d0fb38d8e5
This commit is contained in:
Petr Pchelko 2020-11-11 21:53:01 -07:00
parent c15ed3b6e4
commit 2677811351
2 changed files with 5 additions and 11 deletions

View file

@ -62,6 +62,9 @@ class SerializationTestUtils {
callable $serializer, callable $serializer,
callable $deserializer callable $deserializer
) { ) {
if ( !is_dir( $serializedDataPath ) ) {
throw new InvalidArgumentException( "{$serializedDataPath} does not exist" );
}
$this->serializedDataPath = $serializedDataPath; $this->serializedDataPath = $serializedDataPath;
$this->ext = $ext; $this->ext = $ext;
$this->serializer = $serializer; $this->serializer = $serializer;

View file

@ -12,23 +12,14 @@ use Wikimedia\Tests\SerializationTestUtils;
*/ */
class GhostFieldAccessTraitTest extends MediaWikiUnitTestCase { class GhostFieldAccessTraitTest extends MediaWikiUnitTestCase {
private $serializationTestUtils;
protected function setUp() : void { protected function setUp() : void {
parent::setUp(); 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 ) { private function provideUnserializedInstances( string $testCaseName ) {
// Not using the trait since we only need deserialization tests.
$serializationTestUtils = new SerializationTestUtils( $serializationTestUtils = new SerializationTestUtils(
__DIR__ . '/../../data/GhostFieldAccess', __DIR__ . '/../../../data/GhostFieldAccess',
[], [],
'serialized', 'serialized',
'serialize', 'serialize',