Code Duplication    Length = 28-28 lines in 3 locations

tests/MetadataManagerTest.php 3 locations

@@ 770-797 (lines=28) @@
767
        $this->assertEquals($expectedDefault, $result->getDefaultValue());
768
    }
769
770
    public function testAddPropertyToEntityType()
771
    {
772
        $metadataManager = new MetadataManager();
773
        $entity = m::mock(TEntityTypeType::class);
774
        $entity->shouldReceive('addToProperty')
775
            ->with(m::type(TEntityPropertyType::class))->andReturnNull()->once();
776
        $name = "name";
777
        $type = "type";
778
        $summary = new TTextType();
779
        $defaultValue = "true";
780
        $longDescription = new TTextType();
781
782
        $result = $metadataManager->addPropertyToEntityType(
783
            $entity,
784
            $name,
785
            $type,
786
            $defaultValue,
787
            false,
788
            false,
789
            null,
790
            $summary,
791
            $longDescription
792
        );
793
        $this->assertNotNull($result);
794
        $this->assertTrue(is_array($result->getDocumentation()));
795
        $this->assertEquals(1, count($result->getDocumentation()));
796
        $this->assertEquals("true", $result->getDefaultValue());
797
    }
798
799
    public function testAddPropertyToEntityTypeOnlySummary()
800
    {
@@ 799-826 (lines=28) @@
796
        $this->assertEquals("true", $result->getDefaultValue());
797
    }
798
799
    public function testAddPropertyToEntityTypeOnlySummary()
800
    {
801
        $metadataManager = new MetadataManager();
802
        $entity = m::mock(TEntityTypeType::class);
803
        $entity->shouldReceive('addToProperty')
804
            ->with(m::type(TEntityPropertyType::class))->andReturnNull()->once();
805
        $name = "name";
806
        $type = "type";
807
        $summary = new TTextType();
808
        $defaultValue = "true";
809
        $longDescription = null;
810
811
        $result = $metadataManager->addPropertyToEntityType(
812
            $entity,
813
            $name,
814
            $type,
815
            $defaultValue,
816
            false,
817
            false,
818
            null,
819
            $summary,
820
            $longDescription
821
        );
822
        $this->assertNotNull($result);
823
        $this->assertTrue(is_array($result->getDocumentation()));
824
        $this->assertEquals(0, count($result->getDocumentation()));
825
        $this->assertEquals("true", $result->getDefaultValue());
826
    }
827
828
    public function testAddPropertyToEntityTypeOnlyDescription()
829
    {
@@ 828-855 (lines=28) @@
825
        $this->assertEquals("true", $result->getDefaultValue());
826
    }
827
828
    public function testAddPropertyToEntityTypeOnlyDescription()
829
    {
830
        $metadataManager = new MetadataManager();
831
        $entity = m::mock(TEntityTypeType::class);
832
        $entity->shouldReceive('addToProperty')
833
            ->with(m::type(TEntityPropertyType::class))->andReturnNull()->once();
834
        $name = "name";
835
        $type = "type";
836
        $summary = null;
837
        $defaultValue = "true";
838
        $longDescription = new TTextType();
839
840
        $result = $metadataManager->addPropertyToEntityType(
841
            $entity,
842
            $name,
843
            $type,
844
            $defaultValue,
845
            false,
846
            false,
847
            null,
848
            $summary,
849
            $longDescription
850
        );
851
        $this->assertNotNull($result);
852
        $this->assertTrue(is_array($result->getDocumentation()));
853
        $this->assertEquals(0, count($result->getDocumentation()));
854
        $this->assertEquals("true", $result->getDefaultValue());
855
    }
856
857
    public function testAddEntityTypeWithDocumentation()
858
    {