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

@@ 224-236 (lines=13) @@
221
        $this->assertSame($enum2, $enum3);
222
    }
223
224
    public function testCloneNotCallableAndThrowsLogicException()
225
    {
226
        $enum = EnumBasic::ONE();
227
228
        $reflectionClass  = new ReflectionClass($enum);
229
        $reflectionMethod = $reflectionClass->getMethod('__clone');
230
        $this->assertTrue($reflectionMethod->isPrivate(), 'The method __clone must be private');
231
        $this->assertTrue($reflectionMethod->isFinal(), 'The method __clone must be final');
232
233
        $reflectionMethod->setAccessible(true);
234
        $this->setExpectedException('LogicException');
235
        $reflectionMethod->invoke($enum);
236
    }
237
238
    public function testNotSerializable()
239
    {