Skip to content

Commit

Permalink
typos
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Jul 19, 2024
1 parent 9e9f1bf commit c5a1402
Showing 1 changed file with 11 additions and 25 deletions.
36 changes: 11 additions & 25 deletions tests/ParametersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ public function testConstructPositional(): void
$bar = int();
$parameters = new Parameters($foo, $bar);
$this->assertCount(2, $parameters);
$this->assertSame($foo, $parameters->get('1'));
$this->assertSame($bar, $parameters->get('2'));
$this->assertTrue($parameters->has('0'));
$this->assertTrue($parameters->has('1'));
$this->assertSame($foo, $parameters->get('0'));
$this->assertSame($bar, $parameters->get('1'));
}

public function testRequiredMissing(): void
{
$parameters = new Parameters();
$this->assertFalse($parameters->has('foo'));
$this->expectException(OutOfBoundsException::class);
$this->expectExceptionMessage('Key `foo` not found');
$parameters->required('foo');
Expand All @@ -96,6 +99,7 @@ public function testRequiredMissing(): void
public function testOptionalMissing(): void
{
$parameters = new Parameters();
$this->assertFalse($parameters->has('foo'));
$this->expectException(OutOfBoundsException::class);
$this->expectExceptionMessage('Key `foo` not found');
$parameters->optional('foo');
Expand All @@ -105,6 +109,7 @@ public function testRequiredCasting(): void
{
$parameter = string();
$parameters = new Parameters(foo: $parameter);
$this->assertTrue($parameters->has('foo'));
$this->assertSame($parameter, $parameters->required('foo')->string());
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Parameter `foo` is required');
Expand All @@ -115,10 +120,11 @@ public function testRequiredCastingPositional(): void
{
$parameter = string();
$parameters = new Parameters($parameter);
$this->assertSame($parameter, $parameters->required('1')->string());
$this->assertTrue($parameters->has('0'));
$this->assertSame($parameter, $parameters->required('0')->string());
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Parameter `1` is required');
$parameters->optional('1');
$this->expectExceptionMessage('Parameter `0` is required');
$parameters->optional('0');
}

public function testOptionalCasting(): void
Expand Down Expand Up @@ -341,24 +347,4 @@ public function testWithMakeRequired(): void
$this->expectException(InvalidArgumentException::class);
$parametersWith->withMakeRequired('bar');
}

public function testIsList(): void
{
$parameters = new Parameters();
$this->assertTrue($parameters->isList());
$parameters = new Parameters(
foo: string(),
bar: int()
);
$this->assertFalse($parameters->isList());
$parameters = new Parameters(
string(),
int()
);
$this->assertTrue($parameters->isList());
$parameters = (new Parameters())
->withRequired('a', string())
->withRequired('b', int());
$this->assertTrue($parameters->isList());
}
}

0 comments on commit c5a1402

Please sign in to comment.