Code Duplication    Length = 26-26 lines in 3 locations

tests/MetadataManagerTest.php 3 locations

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