Comments (14)
A workaround which could make this work without an IDE, would be to supply the class as the first argument in the function.
it('foo', function (TestCase $test) {
$test->assertFoo;
});
$this
can still be there, but if users want autocompletion they can do it like that.
Ofc. a PHPStorm plugin can do so it won't be needed in PHPStorm, but this solution could do so it can be used in vscode and so on.
from pest.
I don't know if it's relevant to this issue exactly, but the biggest thing preventing me adopting pest is the PHPStorm integration with the test runner.
I've no idea how it works, sorry, but I know they support PHPUnit, PhpSpec and Behat and I think Codeception.
This would be super useful for PHPStorm users! ❤️
from pest.
I can look into creating a Pest plugin for PHPStorm. Need a bit of a refresher first, I last worked on an intelliJ plugin a while ago.
This will most probably be a "Custom Language Support" plugin, but a "Framework Integration" plugin might allow for more functionality in future.
from pest.
So I can see we never updated this issue, there is a repository for the plugin and with a lot of working features.
A stable release has not been made yet, however it is pretty usable already.
https://github.com/pestphp/pest-intellij
@christophrumpel what you are asking for is possible in the plugin now btw.
from pest.
I got in touch with PHPStorm team. They told me this is something that can be accomplished doing a plugin. We just need to find someone with the expertises to do it. I guess is just a question of having Pest open sourced. 👍
from pest.
This has also implications on the beforeEach
methods. Dynamically defined properties are not "seen" by PHPStorm.
For example:
<?php
beforeEach(function () {
/* @var \Tests\TestCase $this */
$this->fooMock = Mockery::mock(Foo::class);
$this->fooMock->shouldReceive('execute')->andReturnTrue();
});
it('recognises dynamic properties', function () {
/* @var \Tests\TestCase $this */
$this->fooMock->expects('foo'); // No autocomplete on fooMock
});
Currently I can't seem to find a workaround for this.
from pest.
Perfect thanks.
from pest.
Hey people, just tried out the package and I really enjoy writing tests like that. (I didn't thought I would hehe)
For me missing right now is also more support for PhpStorm before I would integrate it in my daily workflow. Like @petemcfarlane said, being able to use PhpStorm's Test Runner would be awesome. I'm really used to go into a test and use a shortcut to run the current test, where my cursor is, or all tests of the current file. Not sure if this would be possible with a plugin?
That's just my first feedback regarding PEST and PhpStorm. Again thanks for the package 👍
from pest.
@tbtmuse That would be awesome. The PHPStorm core team told me that we should take a look into this: https://github.com/Haehnchen/idea-php-symfony2-plugin for grabbing some ideas.
from pest.
@nunomaduro Any reason to not do what @olivernybroe suggested?
As he said, this would benefit developers that don't use phpstorm and $this
can still be bound making this completely optional for the developer. And we wouldn't require a separate phpstorm plugin that someone has to end up maintaining.
from pest.
Concerning autocompletions, the problem will be addressed in Pest 0.2.
from pest.
I don't know if it's relevant to this issue exactly, but the biggest thing preventing me adopting pest is the PHPStorm integration with the test runner.
I got a little bit further using PEST a few days ago to run tests in phpstorm. It's a bit ugly.
But unfortunately I had to give up as PHPStorm just doesn't seem ready yet for Pest.
https://github.com/pestphp/website/issues/39
from pest.
@petemcfarlane @jonnywilliamson
I know this isn't ideal, but since pest passes all args to PHPUnit I've been using --filter
for now. I'd much rather have it mapped to a keystroke but this will do for now.
With a test that looks like this...
```php
// RegisterTest.php
it('requires a password to be at least 8 characters', function () {
// ...
});
Then run your tests...
# run a single file
./vendor/bin/pest --filter RegisterTest
# run a specific test (pretty cool this works!)
./vendor/bin/pest --filter 'requires a password to be at least 8 characters'
And if you want to make it shorter, create the following aliases. I have these in my ~/.zshrc
.
alias pest="./vendor/bin/pest"
alias pestf="./vendor/bin/pest --filter"
If anyone wants to help out, I opened an issue so we can get the cli documented with examples; just been so busy lately!
See #17
from pest.
Has anybody looked into this yet?
I think it makes sense to register pest as a new framework type, to have full control instead of trying to build on top of phpunit. At least my limited experience with plugin creation, says that building on top of the build in types often gives problems because there will be a lot of deprecations in future versions of phpstorm.
So I am thinking something in the likes of this?
from pest.
Related Issues (20)
- [Bug]: Performance issue with `->not->toBeNull()`
- [Bug]: When nesting describers and the describer parent doesn't have test it will skip the beforeEach
- [Bug]: Route will not found if test more than 1 times HOT 2
- [Bug]: Expectation mixin in marked as internal class
- [Bug]: Error when running test using a forelse HOT 2
- Architecture expectations passing when they are expected to fail. HOT 2
- [Bug]: PhpStorm generated Regex filtering out the tests when using 3.x-dev release HOT 2
- [Bug]: Misleading coverage error with read-only vendor
- [Bug]: Tests in parallel are not counting
- [Bug]: DEPR error doesn't show file name.
- [Bug]: --fail-on-risky does not seem to work
- [Bug]: Unknown option "--parallel". github workflow HOT 5
- [Bug]: Could not bind closure. HOT 1
- [Bug]: Text coverage not compatible with coverage-php HOT 1
- [Bug]: Running tests in parallel causes SQLSTATE[HY000] [2006] MySQL server has gone away
- [Bug]: method directoriesByNamespace replacing prefix multiple times resulting in false positive because the directory is not found
- [Bug]: No tests found when filter group with phpunit testcases HOT 1
- [Bug]: mixed-in expectation object causes IDE type errors
- [Bug]: Skipped installation of bin bin/paratest.bat for package brianium/paratest: name conflicts with an existing file HOT 6
- [Bug]: invalid dataset not showing as FAILED when running with --parallel
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pest.