Skip to content

Commit 993e9b3

Browse files
committed
wip
1 parent 28fe1d6 commit 993e9b3

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

tests/SearcherTest.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function getSearcher(): Searcher
2929
/** @test */
3030
public function it_searches_code_strings()
3131
{
32-
$results = $this->searcher
32+
$results = $this->getSearcher()
3333
->functions(['strtolower', 'strtoupper'])
3434
->searchCode('<?' . "php \n\$myVar = strtolower('test');\n");
3535

@@ -41,13 +41,13 @@ public function it_searches_for_function_calls()
4141
{
4242
$file = new File(tests_path('data/file1.php'));
4343

44-
$results = $this->searcher
44+
$results = $this->getSearcher()
4545
->functions(['strtolower', 'strtoupper'])
4646
->search($file);
4747

4848
$this->assertMatchesSnapshot($results->results);
4949

50-
$results = $this->searcher
50+
$results = $this->getSearcher()
5151
->functions(['strtoupper', 'printf', 'strtolower'])
5252
->search($file);
5353

@@ -59,7 +59,7 @@ public function it_searches_for_function_calls_without_snippets()
5959
{
6060
$file = new File(tests_path('data/file1.php'));
6161

62-
$results = $this->searcher
62+
$results = $this->getSearcher()
6363
->functions(['strtolower', 'strtoupper'])
6464
->search($file);
6565

@@ -69,7 +69,7 @@ public function it_searches_for_function_calls_without_snippets()
6969
/** @test */
7070
public function it_searches_for_multi_line_function_calls()
7171
{
72-
$results = $this->searcher
72+
$results = $this->getSearcher()
7373
->functions(['strtolower', 'strtoupper'])
7474
->searchCode('<?' ."php
7575
\$myStr = strtolower(
@@ -86,7 +86,7 @@ public function it_searches_for_static_method_calls()
8686
{
8787
$file = new File(tests_path('data/file1.php'));
8888

89-
$results = $this->searcher
89+
$results = $this->getSearcher()
9090
->static(['MyClass', 'Ray'])
9191
->search($file);
9292

@@ -98,7 +98,7 @@ public function it_searches_for_static_property_accesses()
9898
{
9999
$file = new File(tests_path('data/file1.php'));
100100

101-
$results = $this->searcher
101+
$results = $this->getSearcher()
102102
->static(['Ray::$someProperty'])
103103
->search($file);
104104

@@ -110,7 +110,7 @@ public function it_searches_for_static_method_calls_containing_the_class_and_met
110110
{
111111
$file = new File(tests_path('data/file1.php'));
112112

113-
$results = $this->searcher
113+
$results = $this->getSearcher()
114114
->static(['AnotherClass::enabled'])
115115
->search($file);
116116

@@ -123,7 +123,7 @@ public function it_searches_for_var_assignments()
123123
{
124124
$file = new File(tests_path('data/file1.php'));
125125

126-
$results = $this->searcher
126+
$results = $this->getSearcher()
127127
->assignments(['obj'])
128128
->search($file);
129129

@@ -135,7 +135,7 @@ public function it_searches_for_classes_created_by_new()
135135
{
136136
$file = new File(tests_path('data/file1.php'));
137137

138-
$results = $this->searcher
138+
$results = $this->getSearcher()
139139
->classes(['MyClass'])
140140
->search($file);
141141

@@ -147,7 +147,7 @@ public function it_searches_for_class_definitions()
147147
{
148148
$file = new File(tests_path('data/file3.php'));
149149

150-
$results = $this->searcher
150+
$results = $this->getSearcher()
151151
->classes(['MyClass1'])
152152
->search($file);
153153

@@ -164,7 +164,7 @@ public function it_only_returns_the_functions_being_searched_for()
164164
$this->assertCount(1, $results->results);
165165
$this->assertEquals('strtolower', $results->results[0]->node->name());
166166

167-
$results = $this->searcher
167+
$results = $this->getSearcher()
168168
->functions(['strtoupper'])
169169
->searchCode('<?' . "php \n\$myVar = strtolower(strtoupper('test'));\n");
170170

@@ -175,7 +175,7 @@ public function it_only_returns_the_functions_being_searched_for()
175175
/** @test */
176176
public function it_finds_methods()
177177
{
178-
$results = $this->searcher
178+
$results = $this->getSearcher()
179179
->methods(['methodTwo'])
180180
->searchCode('<?' . "php \n\$myVar = \$obj->methodOne('one'); \$obj->methodTwo(\$obj->methodOne('two'));\n");
181181

@@ -186,7 +186,7 @@ public function it_finds_methods()
186186
/** @test */
187187
public function it_transforms_nested_calls_and_arguments()
188188
{
189-
$results = $this->searcher
189+
$results = $this->getSearcher()
190190
->methods(['methodTwo'])
191191
->searchCode('<?' . "php \$obj->methodTwo(MyModel::find(1), \$obj->methodOne('two', [2, 3]), [\$this, 'handlerMethod']);\n");
192192

@@ -197,7 +197,7 @@ public function it_transforms_nested_calls_and_arguments()
197197
/** @test */
198198
public function it_finds_complex_assignments()
199199
{
200-
$results = $this->searcher
200+
$results = $this->getSearcher()
201201
->assignments(['myVar2'])
202202
->searchCode('<?' . "php
203203
\$myVar = \$obj->methodTwo(MyModel::find(1), \$obj->methodOne('two', [2, 3]), [\$this, 'handlerMethod']);\n
@@ -213,7 +213,7 @@ public function it_finds_complex_assignments()
213213
/** @test */
214214
public function it_finds_binary_operations()
215215
{
216-
$results = $this->searcher
216+
$results = $this->getSearcher()
217217
->assignments(['obj'])
218218
->searchCode('<?' . "php
219219
\$obj = 1 + 3 + 2;
@@ -226,7 +226,7 @@ public function it_finds_binary_operations()
226226
/** @test */
227227
public function it_finds_assign_operations()
228228
{
229-
$results = $this->searcher
229+
$results = $this->getSearcher()
230230
->assignments(['obj'])
231231
->searchCode('<?' . "php
232232
\$obj = 'hello ' . 'world';
@@ -239,7 +239,7 @@ public function it_finds_assign_operations()
239239
/** @test */
240240
public function it_finds_variables()
241241
{
242-
$results = $this->searcher
242+
$results = $this->getSearcher()
243243
->variables(['obj'])
244244
->searchCode('<?' . "php \n\$myVar = \$obj->methodOne('one'); \$obj->methodTwo('two');\n");
245245

@@ -251,7 +251,7 @@ public function it_finds_variables()
251251
/** @test */
252252
public function it_finds_variables_using_regex()
253253
{
254-
$results = $this->searcher
254+
$results = $this->getSearcher()
255255
->variables(['/obj[AB]/'])
256256
->searchCode('<?' . "php \n\$objC = \$objA->methodOne('one'); \$objB->methodTwo('two');\n");
257257

0 commit comments

Comments
 (0)