Skip to content

Commit b3c3053

Browse files
committed
Add more tests
1 parent 284d4b0 commit b3c3053

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/EnumTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,30 @@ public function testEqualsConflictValues()
249249
$this->assertFalse(EnumFixture::FOO()->equals(EnumConflict::FOO()));
250250
}
251251

252+
/**
253+
* fromKey()
254+
*/
255+
public function testFromKey()
256+
{
257+
$number = EnumFixture::BAR();
258+
$fromValue = EnumFixture::fromKey('BAR');
259+
260+
$this->assertSame($number, $fromValue);
261+
}
262+
263+
/**
264+
* fromValue()
265+
*/
266+
public function testFromValue()
267+
{
268+
$enum = EnumFixture::NUMBER();
269+
$number = EnumFixture::fromValue(42);
270+
$inexistant = EnumFixture::fromValue('inexistant');
271+
272+
$this->assertSame($enum, $number);
273+
$this->assertSame(null, $inexistant);
274+
}
275+
252276
/**
253277
* __wakeup()
254278
*/

0 commit comments

Comments
 (0)