1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 17:12:51 +00:00
This commit is contained in:
Jordi Boggiano 2022-08-17 15:20:07 +03:00 committed by GitHub
parent 6e205a0c84
commit 131da999ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
357 changed files with 5943 additions and 9174 deletions

View file

@ -31,32 +31,32 @@ class RuleSetIteratorTest extends TestCase
{
$this->pool = new Pool();
$this->rules = array(
RuleSet::TYPE_REQUEST => array(
new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)),
new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)),
),
RuleSet::TYPE_LEARNED => array(
new GenericRule(array(), Rule::RULE_LEARNED, 1),
),
RuleSet::TYPE_PACKAGE => array(),
);
$this->rules = [
RuleSet::TYPE_REQUEST => [
new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]),
new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]),
],
RuleSet::TYPE_LEARNED => [
new GenericRule([], Rule::RULE_LEARNED, 1),
],
RuleSet::TYPE_PACKAGE => [],
];
}
public function testForeach(): void
{
$ruleSetIterator = new RuleSetIterator($this->rules);
$result = array();
$result = [];
foreach ($ruleSetIterator as $rule) {
$result[] = $rule;
}
$expected = array(
$expected = [
$this->rules[RuleSet::TYPE_REQUEST][0],
$this->rules[RuleSet::TYPE_REQUEST][1],
$this->rules[RuleSet::TYPE_LEARNED][0],
);
];
$this->assertEquals($expected, $result);
}
@ -65,16 +65,16 @@ class RuleSetIteratorTest extends TestCase
{
$ruleSetIterator = new RuleSetIterator($this->rules);
$result = array();
$result = [];
foreach ($ruleSetIterator as $key => $rule) {
$result[] = $key;
}
$expected = array(
$expected = [
RuleSet::TYPE_REQUEST,
RuleSet::TYPE_REQUEST,
RuleSet::TYPE_LEARNED,
);
];
$this->assertEquals($expected, $result);
}