Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing nearest doesn't always work #76

Closed
dakira opened this issue Dec 4, 2017 · 7 comments
Closed

Testing nearest doesn't always work #76

dakira opened this issue Dec 4, 2017 · 7 comments
Labels

Comments

@dakira
Copy link

dakira commented Dec 4, 2017

I don't have it down 100%, yet but it seems if the test has or overrides a setUp() method, running the "nearest" test stops working. I don't have a good example right now, but there is a tutorial available where this happens:

git clone git@github.com:laracasts/Lets-Build-a-Forum-in-Laravel.git forum
cd forum
composer install
cp .env.example .env
php artisan key:generate

Now open Sublime Text and try to run "nearest" in tests/Feature/CreateThreadsTest.php. It will either run all tests (happens at the beginning of the file) or not run at all (further down).

@dakira
Copy link
Author

dakira commented Dec 6, 2017

Hey. This doesn't seem to completely solve the issue. While is fixes the cases where "Test Nearest" doesn't run at all, it still causes "Test Nearest" to run all tests in the file, no matter where the cursor is.

@gerardroche
Copy link
Owner

gerardroche commented Dec 7, 2017

I can't reproduce that. If you could enable debug mode and provide some of the messages. Also:

  • OS?
  • ST version?

You can those from the debug log (Menu > View > Show Console)

To enable the debug messages set environment variable SUBLIME_PHPUNIT_DEBUG to a non blank value, or launch Sublime Text with it set, e.g. on Linux:

$ export SUBLIME_PHPUNIT_DEBUG=y; subl

See https://github.com/gerardroche/sublime-phpunit#debugging

That'll give extra verbose debug messages about what PHPUnitKit is doing.

@gerardroche gerardroche reopened this Dec 7, 2017
@gerardroche
Copy link
Owner

gerardroche commented Dec 7, 2017

Are you using the php-grammar package?

@gerardroche
Copy link
Owner

I can confirm there's an issue with compatibility with php-grammar. So if you're using that package, then you don't need to provide the debug log. I'll try get a fix for that shortly.

@dakira
Copy link
Author

dakira commented Dec 7, 2017

Hey, I am indeed using your php-grammar package. I can confirm everything works fine without that package. Thanks! And thanks for this awesome package. It makes testing such a joy in ST. The only thing I'm missing would be to run "test nearest" with the cursor anywhere inside a test method and not just on the method name.

@gerardroche
Copy link
Owner

I'm missing would be to run "test nearest" with the cursor anywhere inside a test method and not just on the method name.

That's actually supported using the default PHP package i.e. php-grammar doesn't support it. php-grammar uses a custom PHP syntax and it has diverged from the default PHP package syntax. The intention is to remove that custom syntax from php-grammar and for the package to use the default package syntax instead. I just haven't got around doing that. Hopefully I'll get some time to do it.

@dakira
Copy link
Author

dakira commented Dec 8, 2017

Good to know.. I guess I'll use the default package in favor of easier testing for a while. Is there an issue on php-grammar that I can track?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants