Skip to content

Commit

Permalink
Does this hit the mark ?
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Jan 24, 2025
1 parent 5ee77b3 commit 3460a53
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tests/Core/Ruleset/ExpandRulesetReferenceTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* Test the Ruleset::expandRulesetReference() method.
*
* @author Juliette Reinders Folmer <[email protected]>
* @copyright 2024 PHPCSStandards and contributors
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
*/

namespace PHP_CodeSniffer\Tests\Core\Ruleset;

use PHP_CodeSniffer\Ruleset;
use PHP_CodeSniffer\Tests\ConfigDouble;
use PHP_CodeSniffer\Tests\Core\Ruleset\AbstractRulesetTestCase;

/**
* Test various aspects of the Ruleset::expandRulesetReference() method not covered by other tests.
*
* @covers \PHP_CodeSniffer\Ruleset::expandRulesetReference
*/
final class ExpandRulesetReferenceTest extends AbstractRulesetTestCase
{

/**
* The Ruleset object.
*
* @var \PHP_CodeSniffer\Ruleset
*/
private static $ruleset;


/**
* Initialize the config and ruleset objects for this test only once (but do allow recording code coverage).
*
* @xxbefore
*
* @return void
*/
protected function initializeConfigAndRuleset()
{
// @phpstan-ignore isset.property, identical.alwaysFalse
if (isset(self::$ruleset) === false) {
// Set up the ruleset.
$standard = __DIR__."/ExpandRulesetReferenceTest.xml";
$config = new ConfigDouble(["--standard=$standard"]);
self::$ruleset = new Ruleset($config);
}

}//end initializeConfigAndRuleset()


public function testEverythingElse()
{
// Set up the ruleset.
$standard = __DIR__."/ExpandRulesetReferenceTest.xml";
$config = new ConfigDouble(["--standard=$standard"]);
$ruleset = new Ruleset($config);
}

}//end class
7 changes: 7 additions & 0 deletions tests/Core/Ruleset/ExpandRulesetReferenceTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ExpandRulesetReferenceTest" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">

<!-- LINE 993-994 ?? test ONLINE Including a category of sniffs via a ruleset relative directory ref. -->
<rule ref="./fixtures/teststandard/sniffs/validsniffs"/>

</ruleset>

0 comments on commit 3460a53

Please sign in to comment.