Skip to content

Commit fc6dce5

Browse files
committed
RuleInclusion*Test: remove a few redundant assertions
These assertions are checking whether explicitly declared properties exist, which is redundant. Removing the assertions does not diminish the value of the tests as there are follow-up assertions testing the value of the properties. Removing the assertions also gets rid of a warning thrown in PHPUnit 9.6.x about the `assertObjectHasAttribute()` assertion being removed in PHPUnit 10.0. Note: PHPUnit 10.1.0 adds these assertions back again, but under a different name `assertObjectHasProperty()`.
1 parent 1d9a24e commit fc6dce5

File tree

3 files changed

+0
-4
lines changed

3 files changed

+0
-4
lines changed

tests/Core/Ruleset/RuleInclusionAbsoluteLinuxTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ public function tearDown()
9898
public function testLinuxStylePathRuleInclusion()
9999
{
100100
// Test that the sniff is correctly registered.
101-
$this->assertObjectHasAttribute('sniffCodes', $this->ruleset);
102101
$this->assertCount(1, $this->ruleset->sniffCodes);
103102
$this->assertArrayHasKey('Generic.Formatting.SpaceAfterNot', $this->ruleset->sniffCodes);
104103
$this->assertSame(

tests/Core/Ruleset/RuleInclusionAbsoluteWindowsTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ public function tearDown()
9999
public function testWindowsStylePathRuleInclusion()
100100
{
101101
// Test that the sniff is correctly registered.
102-
$this->assertObjectHasAttribute('sniffCodes', $this->ruleset);
103102
$this->assertCount(1, $this->ruleset->sniffCodes);
104103
$this->assertArrayHasKey('Generic.Formatting.SpaceAfterCast', $this->ruleset->sniffCodes);
105104
$this->assertSame(

tests/Core/Ruleset/RuleInclusionTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public function tearDown()
113113
*/
114114
public function testHasSniffCodes()
115115
{
116-
$this->assertObjectHasAttribute('sniffCodes', self::$ruleset);
117116
$this->assertCount(14, self::$ruleset->sniffCodes);
118117

119118
}//end testHasSniffCodes()
@@ -222,7 +221,6 @@ public function dataRegisteredSniffCodes()
222221
*/
223222
public function testSettingProperties($sniffClass, $propertyName, $expectedValue)
224223
{
225-
$this->assertObjectHasAttribute('sniffs', self::$ruleset);
226224
$this->assertArrayHasKey($sniffClass, self::$ruleset->sniffs);
227225
$this->assertObjectHasAttribute($propertyName, self::$ruleset->sniffs[$sniffClass]);
228226

0 commit comments

Comments
 (0)