Skip to content

Commit

Permalink
Simplify Converter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Aug 5, 2023
1 parent 1ef7c9d commit 382ac9c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Idna/ConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ConverterTest extends TestCase
*/
public function testToAsciiThrowsException(string $domain): void
{
self::assertNotEmpty(Converter::toAscii($domain, Option::forIDNA2008Ascii())->errors());
self::assertNotEmpty(Converter::toAscii($domain)->errors());
}

/**
Expand All @@ -44,15 +44,15 @@ public static function invalidDomainProvider(): iterable

public function testToUnicodeThrowsException(): void
{
self::assertNotEmpty(Converter::toUnicode('xn--a-ecp.ru', Option::forIDNA2008Unicode())->errors());
self::assertNotEmpty(Converter::toUnicode('xn--a-ecp.ru')->errors());
}

/**
* @dataProvider toUnicodeProvider
*/
public function testToIDN(string $domain, string $expectedDomain): void
{
self::assertSame($expectedDomain, Converter::toUnicode($domain, Option::forIDNA2008Unicode())->domain());
self::assertSame($expectedDomain, Converter::toUnicode($domain)->domain());
}

/**
Expand Down Expand Up @@ -93,7 +93,7 @@ public static function toUnicodeProvider(): iterable
*/
public function testToAscii(string $domain, string $expectedDomain): void
{
self::assertSame($expectedDomain, Converter::toAscii($domain, Option::forIDNA2008Ascii())->domain());
self::assertSame($expectedDomain, Converter::toAscii($domain)->domain());
}

/**
Expand Down Expand Up @@ -123,11 +123,11 @@ public static function toAsciiProvider(): iterable

public function testExceptionThrownOnConversionToAsciiIfTheDomainIsTooLong(): void
{
self::assertNotEmpty(Converter::toAscii(str_repeat('A', 255), Option::forIDNA2008Ascii())->errors());
self::assertNotEmpty(Converter::toAscii(str_repeat('A', 255))->errors());
}

public function testExceptionThrownOnConversionToAsciiIfTheDomainLabelIsTooLong(): void
{
self::assertNotEmpty(Converter::toAscii('aa'.str_repeat('A', 64), Option::forIDNA2008Ascii())->errors());
self::assertNotEmpty(Converter::toAscii('aa'.str_repeat('A', 64))->errors());
}
}

0 comments on commit 382ac9c

Please sign in to comment.