Code Duplication    Length = 27-27 lines in 3 locations

tests/MetadataManagerTest.php 3 locations

@@ 452-478 (lines=27) @@
449
        $this->assertNull($result->getDocumentation());
450
    }
451
452
    public function testCreateSingletonWithDocumentation()
453
    {
454
        $msg = null;
455
        $name = 'singleton';
456
        $shortDesc = new TTextType();
457
        $longDesc = new TTextType();
458
459
        $returnType = m::mock(TEntityTypeType::class)->makePartial();
460
        $returnType->shouldReceive('getName')->andReturn('doubleton');
461
462
        $entityContainer = m::mock(EntityContainer::class)->makePartial();
463
        $entityContainer->shouldReceive('addToFunctionImport')->andReturn(null)->once();
464
465
        $schema = m::mock(Schema::class)->makePartial();
466
        $schema->shouldReceive('getEntityContainer')->andReturn([$entityContainer])->once();
467
        $edmx = m::mock(Edmx::class)->makePartial();
468
        $edmx->shouldReceive('getDataServiceType->getSchema')->andReturn([$schema])->once();
469
470
        $foo = m::mock(MetadataManager::class)->makePartial()->shouldAllowMockingProtectedMethods();
471
        $foo->shouldReceive('getEdmx')->andReturn($edmx);
472
        $foo->shouldReceive('getNamespace')->andReturn('Data')->atLeast(1);
473
474
        $result = $foo->createSingleton($name, $returnType, $shortDesc, $longDesc);
475
        $this->assertTrue($result instanceof EntityContainer\FunctionImportAnonymousType, get_class($result));
476
        $this->assertTrue($result->isOK($msg));
477
        $this->assertNotNull($result->getDocumentation());
478
    }
479
480
    public function testCreateSingletonWithDocumentationOnlyShortDesc()
481
    {
@@ 480-506 (lines=27) @@
477
        $this->assertNotNull($result->getDocumentation());
478
    }
479
480
    public function testCreateSingletonWithDocumentationOnlyShortDesc()
481
    {
482
        $msg = null;
483
        $name = 'singleton';
484
        $shortDesc = new TTextType();
485
        $longDesc = null;
486
487
        $returnType = m::mock(TEntityTypeType::class)->makePartial();
488
        $returnType->shouldReceive('getName')->andReturn('doubleton');
489
490
        $entityContainer = m::mock(EntityContainer::class)->makePartial();
491
        $entityContainer->shouldReceive('addToFunctionImport')->andReturn(null)->once();
492
493
        $schema = m::mock(Schema::class)->makePartial();
494
        $schema->shouldReceive('getEntityContainer')->andReturn([$entityContainer])->once();
495
        $edmx = m::mock(Edmx::class)->makePartial();
496
        $edmx->shouldReceive('getDataServiceType->getSchema')->andReturn([$schema])->once();
497
498
        $foo = m::mock(MetadataManager::class)->makePartial()->shouldAllowMockingProtectedMethods();
499
        $foo->shouldReceive('getEdmx')->andReturn($edmx);
500
        $foo->shouldReceive('getNamespace')->andReturn('Data')->atLeast(1);
501
502
        $result = $foo->createSingleton($name, $returnType, $shortDesc, $longDesc);
503
        $this->assertTrue($result instanceof EntityContainer\FunctionImportAnonymousType, get_class($result));
504
        $this->assertTrue($result->isOK($msg));
505
        $this->assertNull($result->getDocumentation());
506
    }
507
508
    public function testCreateSingletonWithDocumentationOnlyLongDesc()
509
    {
@@ 508-534 (lines=27) @@
505
        $this->assertNull($result->getDocumentation());
506
    }
507
508
    public function testCreateSingletonWithDocumentationOnlyLongDesc()
509
    {
510
        $msg = null;
511
        $name = 'singleton';
512
        $shortDesc = null;
513
        $longDesc = new TTextType();
514
515
        $returnType = m::mock(TEntityTypeType::class)->makePartial();
516
        $returnType->shouldReceive('getName')->andReturn('doubleton');
517
518
        $entityContainer = m::mock(EntityContainer::class)->makePartial();
519
        $entityContainer->shouldReceive('addToFunctionImport')->andReturn(null)->once();
520
521
        $schema = m::mock(Schema::class)->makePartial();
522
        $schema->shouldReceive('getEntityContainer')->andReturn([$entityContainer])->once();
523
        $edmx = m::mock(Edmx::class)->makePartial();
524
        $edmx->shouldReceive('getDataServiceType->getSchema')->andReturn([$schema])->once();
525
526
        $foo = m::mock(MetadataManager::class)->makePartial()->shouldAllowMockingProtectedMethods();
527
        $foo->shouldReceive('getEdmx')->andReturn($edmx);
528
        $foo->shouldReceive('getNamespace')->andReturn('Data')->atLeast(1);
529
530
        $result = $foo->createSingleton($name, $returnType, $shortDesc, $longDesc);
531
        $this->assertTrue($result instanceof EntityContainer\FunctionImportAnonymousType, get_class($result));
532
        $this->assertTrue($result->isOK($msg));
533
        $this->assertNull($result->getDocumentation());
534
    }
535
536
    public function testMalformedMultiplicity()
537
    {