Skip to content

Commit a599ac5

Browse files
committed
Merge branch 'singleton' of github.com:marc-mabe/php-enum into namespaces
2 parents 86e6dd8 + da11a15 commit a599ac5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/MabeEnumTest/EnumTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,18 @@ public function testClear()
107107
$this->assertNotSame($enum1, $enum2);
108108
$this->assertSame($enum2, $enum3);
109109
}
110+
111+
public function testCloneNotCallableAndThrowsLogicException()
112+
{
113+
$enum = MabeEnumTest_TestAsset_EnumWithoutDefaultValue::ONE();
114+
115+
$reflectionClass = new ReflectionClass($enum);
116+
$reflectionMethod = $reflectionClass->getMethod('__clone');
117+
$this->assertTrue($reflectionMethod->isPrivate(), 'The method __clone must be private');
118+
$this->assertTrue($reflectionMethod->isFinal(), 'The method __clone must be final');
119+
120+
$reflectionMethod->setAccessible(true);
121+
$this->setExpectedException('LogicException');
122+
$reflectionMethod->invoke($enum);
123+
}
110124
}

0 commit comments

Comments
 (0)