atoum / phpstorm-plugin

Integrate atoum inside PhpStorm
https://plugins.jetbrains.com/plugin/8173?pr=phpStorm
MIT License
23 stars 4 forks source link

use atoum.phar to execute tests when it's needed #66

Open CedCannes opened 8 years ago

CedCannes commented 8 years ago

I use atoum.phar on a project. When I run a test with the contextual menu, an error appears because bin/atoum isn't found.

In my test file I have to include/require the atoum.phar like this : require_once __DIR__ . '/atoum.phar';

it may be that detect this kind of require/include in a test file could allow to the plugin executing the atoum.phar to run the tests of this file.

Grummfy commented 8 years ago

for me we should have a configuration part:

I think is the best possibilites

agallou commented 8 years ago

First, some personal thought : I don't understand why the phar is used and why atoum is not installed via composer (like that the dependancy could be in different version for each project, and developpers get atoum on the composer install without any next step).

But if people use it, we should support this.

For now we've managed to avoid having configuration, but will have to add one one day (for test generation for example).

@CedCannes how did you include the phar. Is the phar in the root dir of your project ? On a parent folder of the test ? (the file is commited in the repository ?). (before adding the configuration "path to atoum", we could add an automatic lookup for the phar).

CedCannes commented 8 years ago

@agallou Usually on my projects, atoum is installed via composer. This time, on a project that does not belong to me and not using composer, I needed to use atoum without making too many changes in the project. I thought that the simplest and least intrusive would be use the atoum.phar. So I created folders for my test files at the project root directories and I included the atoum.phar in it. [ProjectRootDirectory]/Tests/Units/atoum.phar

In my test files I added atoum.phar as specified in the documentation require_once __DIR__. '/atoum.phar'; When the two files was created, the class and the test, your plugin does its job and I had access to the atoum menu on right click. Obviously the test launch does not work, it does not bother me, I use the terminal. But I thought that by detecting in the test file the line that include atoum.phar the pluggin could decide to execute the test with this phar.

I think you're right, atoum is mostly used with composer, this feature is probably not expected.