olimorris / neotest-phpunit

🧪 Neotest adapter for PHPUnit
MIT License
29 stars 22 forks source link

Discovering tests marked with attribute #20

Closed HalfBottleOfMind closed 4 months ago

HalfBottleOfMind commented 6 months ago

Hello! Just started working with this package and find that it does not find tests marked with attribute. I think this is important since marking with phpdoc is deprecatred by phpunit.

Here is my PR to support attribute marking.

It also contains commit, that fixes test dicovering by method name. Phpunit documentation says that method name should start with 'test', but regex in query hits even if 'test' is in middle of method name.

Thank you!

olimorris commented 6 months ago

Fantastic, thanks. Could you include some example PHP tests that showcase what you've discussed? Would love to include them in the adapter.

HalfBottleOfMind commented 6 months ago

Ok, i'll try to add tests, but i need some time because i'm not familiar with lua and testing in lua

HalfBottleOfMind commented 6 months ago

Sorry to bother you, but i think i need some help How do i run tests? Do i need to do something beside just run ./scripts/test? Anything preinstall?

I've got E492: Not an editor command: PlenaryBustedFile specs/utils_spec.lua error when running that file. And E5108: Error executing lua ...ocal/share/nvim/lazy/plenary.nvim/lua/plenary/busted.lua:267: ./lua/neotest-phpunit/utils.lua:1: module 'neotest.logging' not found error when executing this command in nvim.

olimorris commented 6 months ago

Oh sorry I meant add some example phpunit tests to the tests/ dir

HalfBottleOfMind commented 6 months ago

Done

Please pay attention to my first commit, which changes regex It brings the package behavior in line with phpunit, but these may be breaking changes

olimorris commented 6 months ago

The test:

#[Test]
    public function this_test_should_run()
    {
        $this->assertTrue(true);
    }

Doesn't run for me. It reads like it should

HalfBottleOfMind commented 6 months ago

I think there is a problem somewhere in phpunit output parser I'm running attribute marked test through summary and summary says the test is failed although phpunit output says it's ok But if i'm running all tests in file (which contains tests marked with comment) summary says this test was successful

I'm sorry, i don't think i can handle this problem right now

olimorris commented 4 months ago

Happy for this to be picked up at a later point in time.