Page MenuHomeWickedGov Phorge

MWDoxygenFilterTest.php
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

MWDoxygenFilterTest.php

<?php
use MediaWiki\Maintenance\MWDoxygenFilter;
/**
* @covers \MediaWiki\Namespace\MWDoxygenFilter
*/
class MWDoxygenFilterTest extends \PHPUnit\Framework\TestCase {
public static function provideFilter() {
yield 'No @var' => [
<<<'CODE'
<?php class MyClass {
/** Some Words here */
protected $name;
}
CODE
];
yield 'One-line var with type' => [
<<<'CODE'
<?php class MyClass {
/** @var SomeType */
protected $name;
}
CODE
, <<<'CODE'
<?php class MyClass {
/** */
protected SomeType $name;
}
CODE
];
yield 'One-line var with type and description' => [
<<<'CODE'
<?php class MyClass {
/** @var SomeType Some description */
protected $name;
}
CODE
, <<<'CODE'
<?php class MyClass {
/** Some description */
protected SomeType $name;
}
CODE
];
yield 'One-line var with type and description that starts like a variable name' => [
<<<'CODE'
<?php class MyClass {
/** @var array $_GET data from some thing */
protected $name;
}
CODE
, <<<'CODE'
<?php class MyClass {
/** $_GET data from some thing */
protected array $name;
}
CODE
];
yield 'One-line var with type, name, and description' => [
// In this full form, Doxygen understands it just fine.
// No changes made.
<<<'CODE'
<?php class MyClass {
/** @var SomeType $name Some description */
protected $name;
}
CODE
];
yield 'Multi-line var with type' => [
<<<'CODE'
<?php class MyClass {
/**
* @var SomeType
*/
protected $name;
}
CODE
, <<<'CODE'
<?php class MyClass {
/**
*
*/
protected SomeType $name;
}
CODE
];
yield 'Multi-line var with type and description' => [
<<<'CODE'
<?php class MyClass {
/**
* Some description
* @var SomeType
*/
protected $name;
}
CODE
, <<<'CODE'
<?php class MyClass {
/**
* Some description
*
*/
protected SomeType $name;
}
CODE
];
yield 'Multi-line var with type, name, and description' => [
<<<'CODE'
<?php class MyClass {
/**
* Some description
* @var SomeType $name
*/
protected $name;
}
CODE
, <<<'CODE'
<?php class MyClass {
/**
* Some description
* @var SomeType $name
*/
protected $name;
}
CODE
];
}
/**
* @dataProvider provideFilter
*/
public function testFilter( $source, $expected = null ) {
$this->assertSame(
$expected ?? $source,
MWDoxygenFilter::filter( $source ),
'Source code'
);
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Nov 21, 20:36 (1 d, 10 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2a/19/8fcfbfcb4938aabdf57a30d153c3
Default Alt Text
MWDoxygenFilterTest.php (2 KB)

Event Timeline