I don't think these do anything with the documentation generators we currently use. Especially not in tests. How are tests part of a "package" when the code is not? Note how most of these are simply identical to the namespace. They are most probably auto-generated by some IDEs but don't actually mean anything. Change-Id: I771b5f2041a8e3b077865c79cbebddbe028543d1
54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Wikimedia\Tests\Reflection;
|
|
|
|
use MediaWikiUnitTestCase;
|
|
use Wikimedia\Tests\SerializationTestUtils;
|
|
|
|
/**
|
|
* @covers \Wikimedia\Reflection\GhostFieldAccessTrait
|
|
*/
|
|
class GhostFieldAccessTraitTest extends MediaWikiUnitTestCase {
|
|
|
|
private static function provideUnserializedInstances( string $testCaseName ) {
|
|
// Not using the trait since we only need deserialization tests.
|
|
$serializationTestUtils = new SerializationTestUtils(
|
|
__DIR__ . '/../../../data/GhostFieldAccess',
|
|
[],
|
|
'serialized',
|
|
'serialize',
|
|
'unserialize'
|
|
);
|
|
$instances = $serializationTestUtils
|
|
->getDeserializedInstancesForTestCase( GhostFieldTestClass::class, $testCaseName );
|
|
foreach ( $instances as $instance ) {
|
|
yield "{$instance->version}" => [ $instance->object ];
|
|
}
|
|
}
|
|
|
|
public function provideUnserializedInstancesWithValues() {
|
|
return $this->provideUnserializedInstances( 'withValues' );
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideUnserializedInstancesWithValues
|
|
*/
|
|
public function testUnserializedWithValues( GhostFieldTestClass $instance ) {
|
|
$this->assertSame( 'private_value', $instance->getPrivateField() );
|
|
$this->assertSame( 'protected_value', $instance->getProtectedField() );
|
|
$this->assertSame( 'public_value', $instance->getPublicField() );
|
|
}
|
|
|
|
public function provideUnserializedInstancesWithNulls() {
|
|
return $this->provideUnserializedInstances( 'withNulls' );
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideUnserializedInstancesWithNulls
|
|
*/
|
|
public function testUnserializedWithNulls( GhostFieldTestClass $instance ) {
|
|
$this->assertNull( $instance->getPrivateField() );
|
|
$this->assertNull( $instance->getProtectedField() );
|
|
$this->assertNull( $instance->getPublicField() );
|
|
}
|
|
}
|