ILIAS  trunk Revision v11.0_alpha-2658-ge2404539063
NameTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
26 class NameTest extends TestCase
27 {
28  #[\PHPUnit\Framework\Attributes\DataProvider('properNames')]
29  public function testProperNames(string $name): void
30  {
31  $n = new Name($name);
32  $this->assertEquals($name, (string) $n);
33  }
34 
35  #[\PHPUnit\Framework\Attributes\DataProvider('improperNames')]
36  public function testImproperNames(string $name): void
37  {
38  $this->expectException(\InvalidArgumentException::class);
39  $n = new Name($name);
40  }
41 
42  public static function properNames(): array
43  {
44  return [
45  [\ILIAS\Component\Tests::class],
46  [\Foo\Bar\Baz::class]
47  ];
48  }
49 
50  public static function improperNames(): array
51  {
52  return [
53  ['ILIAS \Component\Tests'],
54  [\ILIAS\Component::class]
55  ];
56  }
57 }