for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SubjectivePHPTest\Spl\Types;
use SubjectivePHP\Spl\Types\AbstractEnum;
use PHPUnit\Framework\TestCase;
/**
* Unit tests for the SubjectivePHP\Spl\Types\AbstractEnum class.
*
* @coversDefaultClass \SubjectivePHP\Spl\Types\AbstractEnum
* @covers ::<private>
*/
final class AbstractEnumTests extends TestCase
{
* Verify basic behavior of __callStatic.
* @test
* @covers ::__callStatic
* @covers ::__toString
* @return void
public function basicUse()
$this->assertSame(SimpleEnum::FOO, (string)SimpleEnum::Foo());
}
* Verify exception is thrown if __callStatic is invoked with an invalid value.
* @expectedException \UnexpectedValueException
* @expectedExceptionMessage 'Invalid' is not a valid SubjectivePHPTest\Spl\Types\SimpleEnum
public function badConstant()
/** @scrutinizer ignore-call */ SimpleEnum::Invalid();
* Verify basic behavior of all().
* @covers ::all
public function all()
$all = SimpleEnum::all();
$this->assertCount(2, $all);
$this->assertSame(SimpleEnum::FOO, (string)$all[0]);
$this->assertSame(SimpleEnum::BAR, (string)$all[1]);