Skip to content

Commit c48a51c

Browse files
committed
add regression test for chained static method call names
1 parent a064b12 commit c48a51c

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

tests/SearcherTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,16 @@ public function it_searches_for_function_definitions()
277277

278278
$this->assertMatchesSnapshot($results->results);
279279
}
280+
281+
/** @test */
282+
public function it_can_handle_chained_static_and_regular_calls()
283+
{
284+
$file = new File(tests_path('data/file4.php'));
285+
286+
$results = $this->getSearcher()
287+
->methods(['firstOrFail'])
288+
->search($file);
289+
290+
$this->assertMatchesSnapshot($results->results);
291+
}
280292
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-
2+
location: { column: 0, endLine: 6, startLine: 3 }
3+
node: { variableName: { subNodeNames: [name], specialClassName: false, type: Identifier, line: 5, startLine: 5, endLine: 5, startTokenPos: -1, endTokenPos: -1, startFilePos: -1, endFilePos: -1, comments: { }, docComment: null, attributes: { startLine: 5, endLine: 5 }, name: whereSessionRegistrationUuid }, methodName: firstOrFail, name: $whereSessionRegistrationUuid->firstOrFail, args: { }, location: { column: 0, endLine: 6, startLine: 3 } }
4+
snippet: null

tests/data/file4.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
$checkInResponse = CheckInResponse
4+
::whereCheckInRequestUuid($requestUuid)
5+
::whereSessionRegistrationUuid($sessionRegistration->uuid)
6+
->firstOrFail();

0 commit comments

Comments
 (0)