Skip to content

Commit

Permalink
simplify test names
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Sep 11, 2024
1 parent ec9d42b commit d82f7cf
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions src/Microplate/Scalars/Column12.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class Column12 extends IntRange
{
public ?string $description = 'Represents a column in a coordinate system with 12 columns. Allowed values range from 1-12.';

protected static function max(): int
protected static function min(): int
{
return 12;
return 1;
}

protected static function min(): int
protected static function max(): int
{
return 1;
return 12;
}
}
10 changes: 5 additions & 5 deletions tests/Microplate/Scalars/Column12Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@ protected function setUp(): void
}
}

public function testSerializeThrowsIfColumn12IsNotAnInt(): void
public function testSerializeThrowsIfNotAnInt(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Value not in range 1-12: "12".');

(new Column12())->serialize('12');
}

public function testSerializeThrowsIfColumn12IsInvalid(): void
public function testSerializeThrowsIfInvalid(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Value not in range 1-12: 13.');

(new Column12())->serialize(13);
}

public function testSerializePassesWhenColumn12IsValid(): void
public function testSerializePassesValid(): void
{
$serializedResult = (new Column12())->serialize(12);

self::assertSame(12, $serializedResult);
}

public function testParseValueThrowsIfColumn12IsInvalid(): void
public function testParseValueThrowsIfInvalid(): void
{
$this->expectException(Error::class);
$this->expectExceptionMessage('Value not in range 1-12: 13.');

(new Column12())->parseValue(13);
}

public function testParseValuePassesIfColumn12IsValid(): void
public function testParseValuePassesIfValid(): void
{
self::assertSame(
12,
Expand Down
10 changes: 5 additions & 5 deletions tests/Microplate/Scalars/Column2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@ protected function setUp(): void
}
}

public function testSerializeThrowsIfColumn2WellIsNotAnInt(): void
public function testSerializeThrowsIfNotAnInt(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Value not in range 1-2: "3".');

(new Column2())->serialize('3');
}

public function testSerializeThrowsIfColumn2WellIsInvalid(): void
public function testSerializeThrowsIfInvalid(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Value not in range 1-2: 3.');

(new Column2())->serialize(3);
}

public function testSerializePassesWhenColumn2WellIsValid(): void
public function testSerializePassesWhenValid(): void
{
$serializedResult = (new Column2())->serialize(2);

self::assertSame(2, $serializedResult);
}

public function testParseValueThrowsIfColumn2WellIsInvalid(): void
public function testParseValueThrowsIfInvalid(): void
{
$this->expectException(Error::class);
$this->expectExceptionMessage('Value not in range 1-2: 3.');

(new Column2())->parseValue(3);
}

public function testParseValuePassesIfColumn2WellIsValid(): void
public function testParseValuePassesIfValid(): void
{
self::assertSame(
2,
Expand Down
12 changes: 6 additions & 6 deletions tests/Microplate/Scalars/Row16Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,46 +19,46 @@ protected function setUp(): void
}
}

public function testSerializeThrowsIfRow16IsInvalid(): void
public function testSerializeThrowsIfInvalid(): void
{
$this->expectException(InvariantViolation::class);
$this->expectExceptionMessage('The given value "W" did not match the regex /^[A-P]$/.');

(new Row16())->serialize('W');
}

public function testSerializeThrowsIfRow16IsNonCapital(): void
public function testSerializeThrowsIfNonCapital(): void
{
$this->expectException(InvariantViolation::class);
$this->expectExceptionMessage('The given value "b" did not match the regex /^[A-P]$/.');

(new Row16())->serialize('b');
}

public function testSerializePassesWhenRow16IsValid(): void
public function testSerializePassesWhenValid(): void
{
$serializedResult = (new Row16())->serialize('H');

self::assertSame('H', $serializedResult);
}

public function testParseValueThrowsIfRow16IsInvalid(): void
public function testParseValueThrowsIfInvalid(): void
{
$this->expectException(Error::class);
$this->expectExceptionMessage('The given value "W" did not match the regex /^[A-P]$/.');

(new Row16())->parseValue('W');
}

public function testParseValueThrowsIfRow16IsNonCapital(): void
public function testParseValueThrowsIfNonCapital(): void
{
$this->expectException(Error::class);
$this->expectExceptionMessage('The given value "h" did not match the regex /^[A-P]$/.');

(new Row16())->parseValue('h');
}

public function testParseValuePassesIfRow16IsValid(): void
public function testParseValuePassesIfValid(): void
{
self::assertSame(
'P',
Expand Down
12 changes: 6 additions & 6 deletions tests/Microplate/Scalars/Row8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,46 +19,46 @@ protected function setUp(): void
}
}

public function testSerializeThrowsIfRow8IsInvalid(): void
public function testSerializeThrowsIfInvalid(): void
{
$this->expectException(InvariantViolation::class);
$this->expectExceptionMessage('The given value "I" did not match the regex /^[A-H]$/.');

(new Row8())->serialize('I');
}

public function testSerializeThrowsIfRow8IsNonCapital(): void
public function testSerializeThrowsIfNonCapital(): void
{
$this->expectException(InvariantViolation::class);
$this->expectExceptionMessage('The given value "h" did not match the regex /^[A-H]$/.');

(new Row8())->serialize('h');
}

public function testSerializePassesWhenRow8IsValid(): void
public function testSerializePassesWhenValid(): void
{
$serializedResult = (new Row8())->serialize('H');

self::assertSame('H', $serializedResult);
}

public function testParseValueThrowsIfRow8IsInvalid(): void
public function testParseValueThrowsIfInvalid(): void
{
$this->expectException(Error::class);
$this->expectExceptionMessage('The given value "I" did not match the regex /^[A-H]$/.');

(new Row8())->parseValue('I');
}

public function testParseValueThrowsIfRow8IsNonCapital(): void
public function testParseValueThrowsIfNonCapital(): void
{
$this->expectException(Error::class);
$this->expectExceptionMessage('The given value "h" did not match the regex /^[A-H]$/.');

(new Row8())->parseValue('h');
}

public function testParseValuePassesIfRow8IsValid(): void
public function testParseValuePassesIfValid(): void
{
self::assertSame(
'H',
Expand Down

0 comments on commit d82f7cf

Please sign in to comment.