Commit 8b448bcf authored by Tim Rohaly's avatar Tim Rohaly Committed by Tim Rohaly
Browse files

Issue #3253921 by TR: Use assertCount() instead of...

Issue #3253921 by TR: Use assertCount() instead of assertEqual()/assertEquals() in tests where appropriate
parent 5c719ce6
Loading
Loading
Loading
Loading
+1 −1
Changes for tests/src/Unit/Integration/Engine/IntegrityCheckTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ class IntegrityCheckTest extends RulesEntityIntegrationTestBase {
    $this->assertEquals(2, iterator_count($all_violations));

    $uuid_violations = $all_violations->getFor($second_action->getUuid());
    $this->assertEquals(1, count($uuid_violations));
    $this->assertCount(1, $uuid_violations);
    $violation = $uuid_violations[0];
    // The Exception message part of the output should be HTML-escaped.
    $this->assertEquals(
+8 −8
Changes for tests/src/Unit/RuleExpressionTest.php: 8 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -241,26 +241,26 @@ class RuleExpressionTest extends RulesUnitTestBase {
    // Delete the first action.
    $uuid = $this->testActionExpression->reveal()->getUuid();
    $this->rule->deleteExpression($uuid);
    $this->assertEquals(2, count($this->rule->getConditions()->getIterator()));
    $this->assertEquals(1, count($this->rule->getActions()->getIterator()));
    $this->assertCount(2, $this->rule->getConditions()->getIterator());
    $this->assertCount(1, $this->rule->getActions()->getIterator());

    // Delete the second condition.
    $uuid = $this->falseConditionExpression->reveal()->getUuid();
    $this->rule->deleteExpression($uuid);
    $this->assertEquals(1, count($this->rule->getConditions()->getIterator()));
    $this->assertEquals(1, count($this->rule->getActions()->getIterator()));
    $this->assertCount(1, $this->rule->getConditions()->getIterator());
    $this->assertCount(1, $this->rule->getActions()->getIterator());

    // Delete the remaining action.
    $uuid = $second_action->reveal()->getUuid();
    $this->rule->deleteExpression($uuid);
    $this->assertEquals(1, count($this->rule->getConditions()->getIterator()));
    $this->assertEquals(0, count($this->rule->getActions()->getIterator()));
    $this->assertCount(1, $this->rule->getConditions()->getIterator());
    $this->assertCount(0, $this->rule->getActions()->getIterator());

    // Delete the remaining condition, rule should be empty now.
    $uuid = $this->trueConditionExpression->reveal()->getUuid();
    $this->rule->deleteExpression($uuid);
    $this->assertEquals(0, count($this->rule->getConditions()->getIterator()));
    $this->assertEquals(0, count($this->rule->getActions()->getIterator()));
    $this->assertCount(0, $this->rule->getConditions()->getIterator());
    $this->assertCount(0, $this->rule->getActions()->getIterator());
  }

}
+1 −1
Changes for tests/src/Unit/RulesConditionContainerTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ class RulesConditionContainerTest extends RulesUnitTestBase {

    $uuid = $this->falseConditionExpression->reveal()->getUuid();
    $this->assertTrue($container->deleteExpression($uuid));
    $this->assertEquals(0, count($nested_container->getIterator()));
    $this->assertCount(0, $nested_container->getIterator());
  }

}