EnumOptionsTraitTest.php 644 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Tools\Test\TestCase\Model\Enum;
  3. use Shim\TestSuite\TestCase;
  4. use TestApp\Model\Enum\FooBar;
  5. class EnumOptionsTraitTest extends TestCase {
  6. /**
  7. * Test partial options.
  8. *
  9. * @return void
  10. */
  11. public function testEnumNarrowing() {
  12. $array = [
  13. 1 => 'One',
  14. 2 => 'Two',
  15. ];
  16. $res = FooBar::options([1, 2]);
  17. $expected = $array;
  18. $this->assertSame($expected, $res);
  19. }
  20. /**
  21. * @return void
  22. */
  23. public function testEnumResorting() {
  24. $array = [
  25. 2 => 'Two',
  26. 1 => 'One',
  27. ];
  28. $res = FooBar::options([FooBar::TWO, FooBar::ONE], $array);
  29. $expected = $array;
  30. $this->assertSame($expected, $res);
  31. }
  32. }