Skip to content

Commit

Permalink
Use name instead of getByValue
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Nov 18, 2024
1 parent 10c597e commit 9835c0c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/ItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public function it_can_validate_the_item_parameter_value(): void
$item = Item::fromAssociative(Token::fromString('babayaga'), ['a' => true]);
self::assertTrue($item->parameterByName('a'));
self::assertTrue($item->parameterByName('a', fn (mixed $value) => true));
self::assertFalse($item->parameterByName(key: 'b', default: false));
self::assertFalse($item->parameterByName(name: 'b', default: false));
}

#[Test]
Expand All @@ -516,7 +516,7 @@ public function it_can_validate_and_trigger_a_custom_error_message(): void

$this->expectExceptionObject(new Violation('The exception has been triggered'));

$item->parameterByName(key: 'a', validate:fn (mixed $value): string => 'The exception has been triggered');
$item->parameterByName(name: 'a', validate:fn (mixed $value): string => 'The exception has been triggered');
}

#[Test]
Expand All @@ -526,7 +526,7 @@ public function it_can_validate_and_trigger_an_error_message_for_missing_paramet

$this->expectExceptionObject(new Violation("The required parameter 'b' is missing."));

$item->parameterByName(key: 'b', required: true);
$item->parameterByName(name: 'b', required: true);
}

#[Test]
Expand All @@ -536,7 +536,7 @@ public function it_can_validate_and_trigger_a_default_error_message(): void

$this->expectExceptionObject(new Violation("The parameter 'a' whose value is '?1' failed validation."));

$item->parameterByName(key: 'a', validate:fn (mixed $value): bool => false);
$item->parameterByName(name: 'a', validate:fn (mixed $value): bool => false);
}

#[Test]
Expand Down

0 comments on commit 9835c0c

Please sign in to comment.