1 | <?php |
||
8 | class AutocompleteControllerTest extends ElasticsearchFunctionalTestBase { |
||
9 | |||
10 | public static $fixture_file = 'elastica/tests/lotsOfPhotos.yml'; |
||
11 | |||
12 | |||
13 | public function setUp() { |
||
14 | parent::setUp(); |
||
15 | $config = Config::inst()->get('FlickrPhotoTO', 'searchable_fields'); |
||
|
|||
16 | |||
17 | \Config::inst()->update('FlickrPhotoTO', 'searchable_autocomplete', array('Title')); |
||
18 | |||
19 | |||
20 | // Delete and assert that it does not exist |
||
21 | $sql = "SELECT ID,Name,ClazzName from SearchableField"; |
||
22 | $records = DB::query($sql); |
||
23 | |||
24 | $filter = array('Name' => 'Title', 'ClazzName' => 'FlickrPhotoTO'); |
||
25 | $sf = SearchableField::get()->filter($filter)->first(); |
||
26 | $sql = "UPDATE ElasticSearchPage_ElasticaSearchableFields SET Searchable=1,". |
||
27 | "EnableAutocomplete=1 where SearchableFieldID=".$sf->ID; |
||
28 | |||
29 | DB::query($sql); |
||
30 | |||
31 | $task = new ReindexTask($this->service); |
||
32 | // null request is fine as no parameters used |
||
33 | $task->run(null); |
||
34 | } |
||
35 | |||
36 | |||
37 | |||
38 | public function testDataObject() { |
||
84 | } |
||
85 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.