Exemple #1
0
 public function testGetArray()
 {
     $arr = TestEnum::getArray();
     $this->assertArrayHasKey('1st', $arr);
     $this->assertArrayHasKey('2nd', $arr);
     $this->assertArrayHasKey('3rd', $arr);
     $this->assertEquals($arr['1st'], "The First One");
     $this->assertEquals($arr['2nd'], "The Second One");
     $this->assertEquals($arr['3rd'], "The Third One");
 }
Exemple #2
0
<?php

namespace EnumTests;

use taiar\enum\AbstractEnum;
class TestEnum extends AbstractEnum
{
    /** @var  TestEnum */
    public static $FIRST;
    /** @var  TestEnum */
    public static $SECOND;
    /** @var  TestEnum */
    public static $THIRD;
    public static function init()
    {
        static::$FIRST = static::register(new TestEnum('1st', 'The First One'));
        static::$SECOND = static::register(new TestEnum('2nd', 'The Second One'));
        static::$THIRD = static::register(new TestEnum('3rd', 'The Third One'));
    }
}
TestEnum::init();