Code Duplication    Length = 27-27 lines in 3 locations

tests/MetadataManagerTest.php 3 locations

@@ 492-518 (lines=27) @@
489
        $this->assertEquals('BorkBorkBorken', $result->getReturnType()[0]->getEntitySetAttribute());
490
    }
491
492
    public function testCreateSingletonWithDocumentation()
493
    {
494
        $msg = null;
495
        $name = 'singleton';
496
        $shortDesc = new TTextType();
497
        $longDesc = new TTextType();
498
499
        $returnType = m::mock(TEntityTypeType::class)->makePartial();
500
        $returnType->shouldReceive('getName')->andReturn('doubleton');
501
502
        $entityContainer = m::mock(EntityContainer::class)->makePartial();
503
        $entityContainer->shouldReceive('addToFunctionImport')->andReturn(null)->once();
504
505
        $schema = m::mock(Schema::class)->makePartial();
506
        $schema->shouldReceive('getEntityContainer')->andReturn([$entityContainer])->once();
507
        $edmx = m::mock(Edmx::class)->makePartial();
508
        $edmx->shouldReceive('getDataServiceType->getSchema')->andReturn([$schema])->once();
509
510
        $foo = m::mock(MetadataManager::class)->makePartial()->shouldAllowMockingProtectedMethods();
511
        $foo->shouldReceive('getEdmx')->andReturn($edmx);
512
        $foo->shouldReceive('getNamespace')->andReturn('Data')->atLeast(1);
513
514
        $result = $foo->createSingleton($name, $returnType, null, $shortDesc, $longDesc);
515
        $this->assertTrue($result instanceof EntityContainer\FunctionImportAnonymousType, get_class($result));
516
        $this->assertTrue($result->isOK($msg));
517
        $this->assertNotNull($result->getDocumentation());
518
    }
519
520
    public function testCreateSingletonWithDocumentationOnlyShortDesc()
521
    {
@@ 520-546 (lines=27) @@
517
        $this->assertNotNull($result->getDocumentation());
518
    }
519
520
    public function testCreateSingletonWithDocumentationOnlyShortDesc()
521
    {
522
        $msg = null;
523
        $name = 'singleton';
524
        $shortDesc = new TTextType();
525
        $longDesc = null;
526
527
        $returnType = m::mock(TEntityTypeType::class)->makePartial();
528
        $returnType->shouldReceive('getName')->andReturn('doubleton');
529
530
        $entityContainer = m::mock(EntityContainer::class)->makePartial();
531
        $entityContainer->shouldReceive('addToFunctionImport')->andReturn(null)->once();
532
533
        $schema = m::mock(Schema::class)->makePartial();
534
        $schema->shouldReceive('getEntityContainer')->andReturn([$entityContainer])->once();
535
        $edmx = m::mock(Edmx::class)->makePartial();
536
        $edmx->shouldReceive('getDataServiceType->getSchema')->andReturn([$schema])->once();
537
538
        $foo = m::mock(MetadataManager::class)->makePartial()->shouldAllowMockingProtectedMethods();
539
        $foo->shouldReceive('getEdmx')->andReturn($edmx);
540
        $foo->shouldReceive('getNamespace')->andReturn('Data')->atLeast(1);
541
542
        $result = $foo->createSingleton($name, $returnType, null, $shortDesc, $longDesc);
543
        $this->assertTrue($result instanceof EntityContainer\FunctionImportAnonymousType, get_class($result));
544
        $this->assertTrue($result->isOK($msg));
545
        $this->assertNull($result->getDocumentation());
546
    }
547
548
    public function testCreateSingletonWithDocumentationOnlyLongDesc()
549
    {
@@ 548-574 (lines=27) @@
545
        $this->assertNull($result->getDocumentation());
546
    }
547
548
    public function testCreateSingletonWithDocumentationOnlyLongDesc()
549
    {
550
        $msg = null;
551
        $name = 'singleton';
552
        $shortDesc = null;
553
        $longDesc = new TTextType();
554
555
        $returnType = m::mock(TEntityTypeType::class)->makePartial();
556
        $returnType->shouldReceive('getName')->andReturn('doubleton');
557
558
        $entityContainer = m::mock(EntityContainer::class)->makePartial();
559
        $entityContainer->shouldReceive('addToFunctionImport')->andReturn(null)->once();
560
561
        $schema = m::mock(Schema::class)->makePartial();
562
        $schema->shouldReceive('getEntityContainer')->andReturn([$entityContainer])->once();
563
        $edmx = m::mock(Edmx::class)->makePartial();
564
        $edmx->shouldReceive('getDataServiceType->getSchema')->andReturn([$schema])->once();
565
566
        $foo = m::mock(MetadataManager::class)->makePartial()->shouldAllowMockingProtectedMethods();
567
        $foo->shouldReceive('getEdmx')->andReturn($edmx);
568
        $foo->shouldReceive('getNamespace')->andReturn('Data')->atLeast(1);
569
570
        $result = $foo->createSingleton($name, $returnType, $shortDesc, $longDesc);
571
        $this->assertTrue($result instanceof EntityContainer\FunctionImportAnonymousType, get_class($result));
572
        $this->assertTrue($result->isOK($msg));
573
        $this->assertNull($result->getDocumentation());
574
    }
575
576
    public function testMalformedMultiplicity()
577
    {