Code Duplication    Length = 25-28 lines in 2 locations

eZ/Publish/API/Repository/Tests/TrashServiceTest.php 2 locations

@@ 526-553 (lines=28) @@
523
     * @see \eZ\Publish\API\Repository\TrashService::findTrashItems()
524
     * @depends eZ\Publish\API\Repository\Tests\TrashServiceTest::testTrash
525
     */
526
    public function testFindTrashItems()
527
    {
528
        $repository = $this->getRepository();
529
        $trashService = $repository->getTrashService();
530
531
        /* BEGIN: Use Case */
532
        $this->createTrashItem();
533
534
        // Create a search query for all trashed items
535
        $query = new Query();
536
        $query->filter = new Criterion\LogicalAnd(
537
            array(
538
                new Criterion\Field('title', Criterion\Operator::LIKE, '*'),
539
            )
540
        );
541
542
        // Load all trashed locations
543
        $searchResult = $trashService->findTrashItems($query);
544
        /* END: Use Case */
545
546
        $this->assertInstanceOf(
547
            '\\eZ\\Publish\\API\\Repository\\Values\\Content\\SearchResult',
548
            $searchResult
549
        );
550
551
        // 4 trashed locations from the sub tree
552
        $this->assertEquals(4, $searchResult->count);
553
    }
554
555
    /**
556
     * Test for the findTrashItems() method.
@@ 603-627 (lines=25) @@
600
     * @see \eZ\Publish\API\Repository\TrashService::emptyTrash()
601
     * @depends eZ\Publish\API\Repository\Tests\TrashServiceTest::testFindTrashItems
602
     */
603
    public function testEmptyTrash()
604
    {
605
        $repository = $this->getRepository();
606
        $trashService = $repository->getTrashService();
607
608
        /* BEGIN: Use Case */
609
        $this->createTrashItem();
610
611
        // Empty the trash
612
        $trashService->emptyTrash();
613
614
        // Create a search query for all trashed items
615
        $query = new Query();
616
        $query->filter = new Criterion\LogicalAnd(
617
            array(
618
                new Criterion\Field('title', Criterion\Operator::LIKE, '*'),
619
            )
620
        );
621
622
        // Load all trashed locations, search result should be empty
623
        $searchResult = $trashService->findTrashItems($query);
624
        /* END: Use Case */
625
626
        $this->assertEquals(0, $searchResult->count);
627
    }
628
629
    /**
630
     * Test for the deleteTrashItem() method.