Code Duplication    Length = 16-21 lines in 3 locations

tests/unit/ControllerAnnotatorTest.php 1 location

@@ 56-71 (lines=16) @@
53
        $this->assertContains('@property string $SubTitle', $content);
54
    }
55
56
    public function testPageControllerGetsAnnotator()
57
    {
58
        $classInfo = new AnnotateClassInfo(AnnotatorPageTestController::class);
59
        $filePath = $classInfo->getClassFilePath();
60
61
        $content = $this->annotator->getGeneratedFileContent(
62
            file_get_contents($filePath),
63
            AnnotatorPageTestController::class
64
        );
65
66
        $this->assertContains(' * Class \SilverLeague\IDEAnnotator\Tests\AnnotatorPageTestController', $content);
67
        $this->assertContains('@property \SilverLeague\IDEAnnotator\Tests\AnnotatorPageTest dataRecord', $content);
68
        $this->assertContains('@method \SilverLeague\IDEAnnotator\Tests\AnnotatorPageTest data()', $content);
69
        $this->assertContains('@mixin \SilverLeague\IDEAnnotator\Tests\AnnotatorPageTest', $content);
70
        $this->assertContains('@mixin \SilverLeague\IDEAnnotator\Tests\AnnotatorPageTest_Extension', $content);
71
    }
72
73
    /**
74
     * Test the generation of annotations for an Extension

tests/unit/DataObjectAnnotatorTest.php 2 locations

@@ 153-173 (lines=21) @@
150
        $this->assertContains('@mixin \SilverLeague\IDEAnnotator\Tests\Team_Extension', $content);
151
    }
152
153
    public function testInversePlayerRelationOfTeam()
154
    {
155
        $classInfo = new AnnotateClassInfo(Player::class);
156
        $filePath = $classInfo->getClassFilePath();
157
158
        $content = $this->annotator->getGeneratedFileContent(file_get_contents($filePath), Player::class);
159
160
        $this->assertContains('@property boolean $IsRetired', $content);
161
        $this->assertContains('@property string $ShirtNumber', $content);
162
        $this->assertContains('@property int $FavouriteTeamID', $content);
163
        $this->assertContains('@method \SilverLeague\IDEAnnotator\Tests\Team FavouriteTeam()', $content);
164
165
        $this->assertContains(
166
            '@method \SilverStripe\ORM\ManyManyList|\SilverLeague\IDEAnnotator\Tests\Team[] TeamPlayer()',
167
            $content
168
        );
169
        $this->assertContains(
170
            '@method \SilverStripe\ORM\ManyManyList|\SilverLeague\IDEAnnotator\Tests\Team[] TeamReserve()',
171
            $content
172
        );
173
    }
174
175
    public function testExistingMethodsWillNotBeTagged()
176
    {
@@ 214-232 (lines=19) @@
211
    /**
212
     * Test the generation of annotations for a DataExtension
213
     */
214
    public function testAnnotateDataExtension()
215
    {
216
        $classInfo = new AnnotateClassInfo(Team_Extension::class);
217
        $filePath = $classInfo->getClassFilePath();
218
        $original = file_get_contents($filePath);
219
        $annotated = $this->annotator->getGeneratedFileContent($original, Team_Extension::class);
220
221
        $this->assertContains(
222
            '@property \SilverLeague\IDEAnnotator\Tests\Team|\SilverLeague\IDEAnnotator\Tests\Team_Extension $owner',
223
            $annotated
224
        );
225
        $this->assertContains('@property string $ExtendedVarcharField', $annotated);
226
        $this->assertContains('@property int $ExtendedIntField', $annotated);
227
        $this->assertContains('@property int $ExtendedHasOneRelationshipID', $annotated);
228
        $this->assertContains(
229
            '@method \SilverLeague\IDEAnnotator\Tests\Player ExtendedHasOneRelationship()',
230
            $annotated
231
        );
232
    }
233
234
    /**
235
     *