Code Duplication    Length = 8-8 lines in 6 locations

Tests/Unit/Domain/Model/BannerTest.php 6 locations

@@ 265-272 (lines=8) @@
262
    /**
263
     * @test
264
     */
265
    public function addCategoryToObjectStorageHoldingCategory()
266
    {
267
        $category = new \TYPO3\CMS\Extbase\Domain\Model\Category();
268
        $categoryObjectStorageMock = $this->getMockBuilder(ObjectStorage::class)->setMethods(['attach'])->getMock();
269
        $categoryObjectStorageMock->expects($this->once())->method('attach')->with($this->equalTo($category));
270
        $this->inject($this->fixture, 'category', $categoryObjectStorageMock);
271
        $this->fixture->addCategory($category);
272
    }
273
274
    /**
275
     * @test
@@ 277-284 (lines=8) @@
274
    /**
275
     * @test
276
     */
277
    public function removeCategoryFromObjectStorageHoldingCategory()
278
    {
279
        $category = new \TYPO3\CMS\Extbase\Domain\Model\Category();
280
        $categoryObjectStorageMock = $this->getMockBuilder(ObjectStorage::class)->setMethods(['detach'])->getMock();
281
        $categoryObjectStorageMock->expects($this->once())->method('detach')->with($this->equalTo($category));
282
        $this->inject($this->fixture, 'category', $categoryObjectStorageMock);
283
        $this->fixture->removeCategory($category);
284
    }
285
286
    /**
287
     * @test
@@ 313-320 (lines=8) @@
310
    /**
311
     * @test
312
     */
313
    public function addExludePagesToObjectStorageHoldingExcludePages()
314
    {
315
        $page = new \DERHANSEN\SfBanners\Domain\Model\Page();
316
        $pageObjectStorageMock = $this->getMockBuilder(ObjectStorage::class)->setMethods(['attach'])->getMock();
317
        $pageObjectStorageMock->expects($this->once())->method('attach')->with($this->equalTo($page));
318
        $this->inject($this->fixture, 'excludepages', $pageObjectStorageMock);
319
        $this->fixture->addExcludepages($page);
320
    }
321
322
    /**
323
     * @test
@@ 325-332 (lines=8) @@
322
    /**
323
     * @test
324
     */
325
    public function removeExludePagesFromObjectStorageHoldingExcludePages()
326
    {
327
        $page = new \DERHANSEN\SfBanners\Domain\Model\Page();
328
        $pageObjectStorageMock = $this->getMockBuilder(ObjectStorage::class)->setMethods(['detach'])->getMock();
329
        $pageObjectStorageMock->expects($this->once())->method('detach')->with($this->equalTo($page));
330
        $this->inject($this->fixture, 'excludepages', $pageObjectStorageMock);
331
        $this->fixture->removeExcludepages($page);
332
    }
333
334
    /**
335
     * @test
@@ 361-368 (lines=8) @@
358
    /**
359
     * @test
360
     */
361
    public function addAssetToObjectStorageHoldingAsses()
362
    {
363
        $file = new \TYPO3\CMS\Extbase\Domain\Model\FileReference();
364
        $assetsObjectStorageMock = $this->getMockBuilder(ObjectStorage::class)->setMethods(['attach'])->getMock();
365
        $assetsObjectStorageMock->expects($this->once())->method('attach')->with($this->equalTo($file));
366
        $this->inject($this->fixture, 'assets', $assetsObjectStorageMock);
367
        $this->fixture->addAsset($file);
368
    }
369
370
    /**
371
     * @test
@@ 373-380 (lines=8) @@
370
    /**
371
     * @test
372
     */
373
    public function removeAssetFromObjectStorageHoldingAsset()
374
    {
375
        $file = new \TYPO3\CMS\Extbase\Domain\Model\FileReference();
376
        $assetsObjectStorageMock = $this->getMockBuilder(ObjectStorage::class)->setMethods(['detach'])->getMock();
377
        $assetsObjectStorageMock->expects($this->once())->method('detach')->with($this->equalTo($file));
378
        $this->inject($this->fixture, 'assets', $assetsObjectStorageMock);
379
        $this->fixture->removeAsset($file);
380
    }
381
}
382