Repeating the variable name doesn't do anything. Documentation generators don't need it. It's more stuff to read that doesn't add new information. And it can become outdated. Note there are two types of @var docs. When used inline (and not on a class property) the variable name is needed. Change-Id: If5a520405efacd8cefd90b878c999b842b91ac61
55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Modelled on Sebastian Bergmann's PHPUnit_Extensions_PhptTestCase class.
|
|
*
|
|
* @see https://github.com/sebastianbergmann/phpunit/blob/master/src/Extensions/PhptTestCase.php
|
|
* @author Sam Smith <samsmith@wikimedia.org>
|
|
* @coversNothing
|
|
*/
|
|
class LessFileCompilationTest extends ResourceLoaderTestCase {
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $file;
|
|
|
|
/**
|
|
* @var ResourceLoaderModule The ResourceLoader module that contains
|
|
* the file
|
|
*/
|
|
protected $module;
|
|
|
|
/**
|
|
* @param string $file
|
|
* @param ResourceLoaderModule $module The ResourceLoader module that
|
|
* contains the file
|
|
*/
|
|
public function __construct( $file, ResourceLoaderModule $module ) {
|
|
parent::__construct( 'testLessFileCompilation' );
|
|
|
|
$this->file = $file;
|
|
$this->module = $module;
|
|
}
|
|
|
|
public function testLessFileCompilation() {
|
|
$thisString = $this->toString();
|
|
$this->assertTrue(
|
|
is_string( $this->file ) && is_file( $this->file ) && is_readable( $this->file ),
|
|
"$thisString must refer to a readable file"
|
|
);
|
|
|
|
$rlContext = $this->getResourceLoaderContext();
|
|
|
|
// Bleh
|
|
$method = new ReflectionMethod( $this->module, 'compileLessFile' );
|
|
$method->setAccessible( true );
|
|
$this->assertNotNull( $method->invoke( $this->module, $this->file, $rlContext ) );
|
|
}
|
|
|
|
public function toString() : string {
|
|
$moduleName = $this->module->getName();
|
|
|
|
return "{$this->file} in the \"{$moduleName}\" module";
|
|
}
|
|
}
|