Code Duplication    Length = 26-26 lines in 3 locations

tests/MetadataManagerTest.php 3 locations

@@ 506-531 (lines=26) @@
503
        $this->assertNull($result->getDocumentation());
504
    }
505
506
    public function testCreateSingletonWithDocumentation()
507
    {
508
        $msg = null;
509
        $name = "singleton";
510
        $shortDesc = new TTextType();
511
        $longDesc = new TTextType();
512
513
        $returnType = m::mock(TEntityTypeType::class)->makePartial();
514
        $returnType->shouldReceive('getName')->andReturn('doubleton');
515
516
        $entityContainer = m::mock(EntityContainer::class)->makePartial();
517
        $entityContainer->shouldReceive('addToFunctionImport')->andReturn(null)->once();
518
519
        $schema = m::mock(Schema::class)->makePartial();
520
        $schema->shouldReceive('getEntityContainer')->andReturn([$entityContainer])->once();
521
        $edmx = m::mock(Edmx::class)->makePartial();
522
        $edmx->shouldReceive('getDataServiceType->getSchema')->andReturn([$schema])->once();
523
524
        $foo = m::mock(MetadataManager::class)->makePartial();
525
        $foo->shouldReceive('getEdmx')->andReturn($edmx);
526
527
        $result = $foo->createSingleton($name, $returnType, $shortDesc, $longDesc);
528
        $this->assertTrue($result instanceof EntityContainer\FunctionImportAnonymousType, get_class($result));
529
        $this->assertTrue($result->isOK($msg));
530
        $this->assertNotNull($result->getDocumentation());
531
    }
532
533
    public function testCreateSingletonWithDocumentationOnlyShortDesc()
534
    {
@@ 533-558 (lines=26) @@
530
        $this->assertNotNull($result->getDocumentation());
531
    }
532
533
    public function testCreateSingletonWithDocumentationOnlyShortDesc()
534
    {
535
        $msg = null;
536
        $name = "singleton";
537
        $shortDesc = new TTextType();
538
        $longDesc = null;
539
540
        $returnType = m::mock(TEntityTypeType::class)->makePartial();
541
        $returnType->shouldReceive('getName')->andReturn('doubleton');
542
543
        $entityContainer = m::mock(EntityContainer::class)->makePartial();
544
        $entityContainer->shouldReceive('addToFunctionImport')->andReturn(null)->once();
545
546
        $schema = m::mock(Schema::class)->makePartial();
547
        $schema->shouldReceive('getEntityContainer')->andReturn([$entityContainer])->once();
548
        $edmx = m::mock(Edmx::class)->makePartial();
549
        $edmx->shouldReceive('getDataServiceType->getSchema')->andReturn([$schema])->once();
550
551
        $foo = m::mock(MetadataManager::class)->makePartial();
552
        $foo->shouldReceive('getEdmx')->andReturn($edmx);
553
554
        $result = $foo->createSingleton($name, $returnType, $shortDesc, $longDesc);
555
        $this->assertTrue($result instanceof EntityContainer\FunctionImportAnonymousType, get_class($result));
556
        $this->assertTrue($result->isOK($msg));
557
        $this->assertNull($result->getDocumentation());
558
    }
559
560
    public function testCreateSingletonWithDocumentationOnlyLongDesc()
561
    {
@@ 560-585 (lines=26) @@
557
        $this->assertNull($result->getDocumentation());
558
    }
559
560
    public function testCreateSingletonWithDocumentationOnlyLongDesc()
561
    {
562
        $msg = null;
563
        $name = "singleton";
564
        $shortDesc = null;
565
        $longDesc = new TTextType();
566
567
        $returnType = m::mock(TEntityTypeType::class)->makePartial();
568
        $returnType->shouldReceive('getName')->andReturn('doubleton');
569
570
        $entityContainer = m::mock(EntityContainer::class)->makePartial();
571
        $entityContainer->shouldReceive('addToFunctionImport')->andReturn(null)->once();
572
573
        $schema = m::mock(Schema::class)->makePartial();
574
        $schema->shouldReceive('getEntityContainer')->andReturn([$entityContainer])->once();
575
        $edmx = m::mock(Edmx::class)->makePartial();
576
        $edmx->shouldReceive('getDataServiceType->getSchema')->andReturn([$schema])->once();
577
578
        $foo = m::mock(MetadataManager::class)->makePartial();
579
        $foo->shouldReceive('getEdmx')->andReturn($edmx);
580
581
        $result = $foo->createSingleton($name, $returnType, $shortDesc, $longDesc);
582
        $this->assertTrue($result instanceof EntityContainer\FunctionImportAnonymousType, get_class($result));
583
        $this->assertTrue($result->isOK($msg));
584
        $this->assertNull($result->getDocumentation());
585
    }
586
587
    public function testMalformedMultiplicity()
588
    {