Skip to content

Commit 3460a53

Browse files
committed
Does this hit the mark ?
1 parent 5ee77b3 commit 3460a53

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* Test the Ruleset::expandRulesetReference() method.
4+
*
5+
* @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl>
6+
* @copyright 2024 PHPCSStandards and contributors
7+
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
8+
*/
9+
10+
namespace PHP_CodeSniffer\Tests\Core\Ruleset;
11+
12+
use PHP_CodeSniffer\Ruleset;
13+
use PHP_CodeSniffer\Tests\ConfigDouble;
14+
use PHP_CodeSniffer\Tests\Core\Ruleset\AbstractRulesetTestCase;
15+
16+
/**
17+
* Test various aspects of the Ruleset::expandRulesetReference() method not covered by other tests.
18+
*
19+
* @covers \PHP_CodeSniffer\Ruleset::expandRulesetReference
20+
*/
21+
final class ExpandRulesetReferenceTest extends AbstractRulesetTestCase
22+
{
23+
24+
/**
25+
* The Ruleset object.
26+
*
27+
* @var \PHP_CodeSniffer\Ruleset
28+
*/
29+
private static $ruleset;
30+
31+
32+
/**
33+
* Initialize the config and ruleset objects for this test only once (but do allow recording code coverage).
34+
*
35+
* @xxbefore
36+
*
37+
* @return void
38+
*/
39+
protected function initializeConfigAndRuleset()
40+
{
41+
// @phpstan-ignore isset.property, identical.alwaysFalse
42+
if (isset(self::$ruleset) === false) {
43+
// Set up the ruleset.
44+
$standard = __DIR__."/ExpandRulesetReferenceTest.xml";
45+
$config = new ConfigDouble(["--standard=$standard"]);
46+
self::$ruleset = new Ruleset($config);
47+
}
48+
49+
}//end initializeConfigAndRuleset()
50+
51+
52+
public function testEverythingElse()
53+
{
54+
// Set up the ruleset.
55+
$standard = __DIR__."/ExpandRulesetReferenceTest.xml";
56+
$config = new ConfigDouble(["--standard=$standard"]);
57+
$ruleset = new Ruleset($config);
58+
}
59+
60+
}//end class
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ExpandRulesetReferenceTest" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
3+
4+
<!-- LINE 993-994 ?? test ONLINE Including a category of sniffs via a ruleset relative directory ref. -->
5+
<rule ref="./fixtures/teststandard/sniffs/validsniffs"/>
6+
7+
</ruleset>

0 commit comments

Comments
 (0)