Code Duplication    Length = 13-15 lines in 3 locations

tests/MabeEnumTest/EnumMapTest.php 2 locations

@@ 263-277 (lines=15) @@
260
        $enumMap->setFlags(5);
261
    }
262
263
    public function testCurrentThrowsRuntimeExceptionOnInvalidFlag()
264
    {
265
        $enumMap = new EnumMap('MabeEnumTest\TestAsset\EnumBasic');
266
        $enumMap->attach(EnumBasic::ONE());
267
        $enumMap->rewind();
268
269
        // change internal flags to an invalid current flag
270
        $reflectionClass = new ReflectionClass($enumMap);
271
        $reflectionProp  = $reflectionClass->getProperty('flags');
272
        $reflectionProp->setAccessible(true);
273
        $reflectionProp->setValue($enumMap, 0);
274
275
        $this->setExpectedException('RuntimeException');
276
        $enumMap->current();
277
    }
278
279
    public function testKeyThrowsRuntimeExceptionOnInvalidFlag()
280
    {
@@ 279-293 (lines=15) @@
276
        $enumMap->current();
277
    }
278
279
    public function testKeyThrowsRuntimeExceptionOnInvalidFlag()
280
    {
281
        $enumMap = new EnumMap('MabeEnumTest\TestAsset\EnumBasic');
282
        $enumMap->attach(EnumBasic::ONE());
283
        $enumMap->rewind();
284
285
        // change internal flags to an invalid current flag
286
        $reflectionClass = new ReflectionClass($enumMap);
287
        $reflectionProp  = $reflectionClass->getProperty('flags');
288
        $reflectionProp->setAccessible(true);
289
        $reflectionProp->setValue($enumMap, 0);
290
291
        $this->setExpectedException('RuntimeException');
292
        $enumMap->key();
293
    }
294
295
    public function testSetFlagsThrowsInvalidArgumentExceptionOnUnsupportedCurrentFlag()
296
    {

tests/MabeEnumTest/EnumTest.php 1 location

@@ 258-270 (lines=13) @@
255
        $this->assertSame($enum2, $enum3);
256
    }
257
258
    public function testCloneNotCallableAndThrowsLogicException()
259
    {
260
        $enum = EnumBasic::ONE();
261
262
        $reflectionClass  = new ReflectionClass($enum);
263
        $reflectionMethod = $reflectionClass->getMethod('__clone');
264
        $this->assertTrue($reflectionMethod->isPrivate(), 'The method __clone must be private');
265
        $this->assertTrue($reflectionMethod->isFinal(), 'The method __clone must be final');
266
267
        $reflectionMethod->setAccessible(true);
268
        $this->setExpectedException('LogicException');
269
        $reflectionMethod->invoke($enum);
270
    }
271
272
    public function testNotSerializable()
273
    {