diff --git a/lua/neotest-phpunit/init.lua b/lua/neotest-phpunit/init.lua index b6c1010..f5f0fdd 100644 --- a/lua/neotest-phpunit/init.lua +++ b/lua/neotest-phpunit/init.lua @@ -102,7 +102,7 @@ function NeotestAdapter.discover_positions(path) )) @namespace.definition ((method_declaration - (name) @test.name (#match? @test.name "test") + (name) @test.name (#match? @test.name "^test") )) @test.definition (((comment) @test_comment (#match? @test_comment "\\@test") . @@ -110,6 +110,16 @@ function NeotestAdapter.discover_positions(path) (name) @test.name ) @test.definition )) + + (((method_declaration + (attribute_list + (attribute_group + (attribute) @test_attribute (#match? @test_attribute "^Test$") + ) + ) + (name) @test.name + ) + )) @test.definition ]] return lib.treesitter.parse_positions(path, query, { diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index 7d58749..b1e1512 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -1,6 +1,7 @@ assertTrue(true); } + public function this_test_should_not_run_also() + { + $this->assertTrue(true); + } + + #[Test] + public function this_test_should_run() + { + $this->assertTrue(true); + } + /** * @dataProvider myProvider */