Code Duplication    Length = 13-25 lines in 4 locations

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

@@ 97-114 (lines=18) @@
94
     *
95
     * @depends testFindContentInfoFullTextIsSearchable
96
     */
97
    public function testFindContentInfoFullTextIsNotSearchable()
98
    {
99
        $searchTerm = 'pamplemousse';
100
        $this->createFullTextIsSearchableContent($searchTerm, false);
101
102
        $repository = $this->getRepository();
103
        $searchService = $repository->getSearchService();
104
105
        $query = new Query(
106
            [
107
                'query' => new Criterion\FullText($searchTerm),
108
            ]
109
        );
110
111
        $searchResult = $searchService->findContentInfo($query);
112
113
        $this->assertEquals(0, $searchResult->totalCount);
114
    }
115
116
    /**
117
     * Test that indexing full text data depends on the isSearchable flag on the field definition.
@@ 121-137 (lines=17) @@
118
     *
119
     * @depends testFindLocationsFullTextIsSearchable
120
     */
121
    public function testFindLocationsFullTextIsNotSearchable()
122
    {
123
        $searchTerm = 'pamplemousse';
124
125
        $repository = $this->getRepository(false);
126
        $searchService = $repository->getSearchService();
127
128
        $query = new LocationQuery(
129
            [
130
                'query' => new Criterion\FullText($searchTerm),
131
            ]
132
        );
133
134
        $searchResult = $searchService->findLocations($query);
135
136
        $this->assertEquals(0, $searchResult->totalCount);
137
    }
138
139
    /**
140
     * Creates Content for testing full text search depending on the isSearchable flag.

eZ/Publish/API/Repository/Tests/FieldType/KeywordIntegrationTest.php 1 location

@@ 594-606 (lines=13) @@
591
     *
592
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
593
     */
594
    public function testFindContentFieldCriterion()
595
    {
596
        $this->createKeywordContent();
597
        $repository = $this->getRepository();
598
599
        $criterion = new Criterion\Field('tags', Criterion\Operator::IN, ['foo']);
600
        $query = new Query(['query' => $criterion]);
601
602
        $searchService = $repository->getSearchService();
603
        $searchResult = $searchService->findContent($query);
604
605
        $this->assertEquals(1, $searchResult->totalCount);
606
    }
607
}
608

eZ/Publish/API/Repository/Tests/TrashServiceTest.php 1 location

@@ 717-741 (lines=25) @@
714
     * @see \eZ\Publish\API\Repository\TrashService::emptyTrash()
715
     * @depends eZ\Publish\API\Repository\Tests\TrashServiceTest::testFindTrashItems
716
     */
717
    public function testEmptyTrash()
718
    {
719
        $repository = $this->getRepository();
720
        $trashService = $repository->getTrashService();
721
722
        /* BEGIN: Use Case */
723
        $this->createTrashItem();
724
725
        // Empty the trash
726
        $trashService->emptyTrash();
727
728
        // Create a search query for all trashed items
729
        $query = new Query();
730
        $query->filter = new Criterion\LogicalAnd(
731
            array(
732
                new Criterion\Field('title', Criterion\Operator::LIKE, '*'),
733
            )
734
        );
735
736
        // Load all trashed locations, search result should be empty
737
        $searchResult = $trashService->findTrashItems($query);
738
        /* END: Use Case */
739
740
        $this->assertEquals(0, $searchResult->count);
741
    }
742
743
    /**
744
     * Test for the deleteTrashItem() method.