Skip to content

Commit f7d8f78

Browse files
committed
PHPunit 9
1 parent 90d42c1 commit f7d8f78

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

tests/MabeEnumTest/EnumSerializableTraitTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class EnumSerializableTraitTest extends TestCase
2121
public function testSerializeSerializableEnum()
2222
{
2323
$serialized = serialize(SerializableEnum::get(SerializableEnum::NIL));
24-
$this->assertInternalType('string', $serialized);
24+
$this->assertSame('string', gettype($serialized));
2525

2626
$unserialized = unserialize($serialized);
2727
$this->assertInstanceOf(SerializableEnum::class, $unserialized);
@@ -30,7 +30,7 @@ public function testSerializeSerializableEnum()
3030
public function testUnserializeFirstWillHoldTheSameInstance()
3131
{
3232
$serialized = serialize(SerializableEnum::get(SerializableEnum::STR));
33-
$this->assertInternalType('string', $serialized);
33+
$this->assertSame('string', gettype($serialized));
3434

3535
// clear all instantiated instances so we can virtual test unserializing first
3636
$this->clearEnumeration(SerializableEnum::class);

tests/MabeEnumTest/EnumTest.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@
2626
*/
2727
class EnumTest extends TestCase
2828
{
29-
public function setUp()
30-
{
31-
$this->resetStaticEnumProps();
32-
}
33-
34-
public function tearDown()
35-
{
36-
assert_options(ASSERT_ACTIVE, 1);
37-
}
38-
3929
/**
4030
* Un-initialize all known enumerations
4131
*/
@@ -325,10 +315,15 @@ public function testEnabledAssertAmbiguousEnumeratorValues()
325315

326316
public function testDisabledAssertAmbiguousEnumeratorValues()
327317
{
328-
assert_options(ASSERT_ACTIVE, 0);
329318
$this->expectException(InvalidArgumentException::class);
330319

331-
EnumAmbiguous::get('unknown');
320+
try {
321+
assert_options(ASSERT_ACTIVE, 0);
322+
EnumAmbiguous::get('unknown');
323+
} catch (\Exception $e) {
324+
assert_options(ASSERT_ACTIVE, 1);
325+
throw $e;
326+
}
332327
}
333328

334329
public function testExtendedEnabledAssertAmbiguousEnumeratorValues()
@@ -345,10 +340,15 @@ public function testExtendedEnabledAssertAmbiguousEnumeratorValues()
345340

346341
public function testExtendedDisabledAssertAmbiguousEnumeratorValues()
347342
{
348-
assert_options(ASSERT_ACTIVE, 0);
349343
$this->expectException(InvalidArgumentException::class);
350344

351-
EnumExtendedAmbiguous::get('unknown');
345+
try {
346+
assert_options(ASSERT_ACTIVE, 0);
347+
EnumExtendedAmbiguous::get('unknown');
348+
} catch (\Exception $e) {
349+
assert_options(ASSERT_ACTIVE, 1);
350+
throw $e;
351+
}
352352
}
353353

354354
public function testSingleton()

0 commit comments

Comments
 (0)