This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I've followed the documentation provided here http://octobercms.com/docs/help/unit-testing#testing-plugins and have a phpunit.xml file along with my tests directory which contains a single Test.php.
All I'm attempting to do is run a single 'fake' test to establish everything is setup and working, however I get the following error.
Time: 1.02 seconds, Memory: 22.00MB
There was 1 error:
1) Daykin\True\Tests\Test::testExample
InvalidArgumentException: Plugin "Daykin.True" not found.
/var/www/true/modules/system/console/PluginRefresh.php:43
/var/www/true/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
/var/www/true/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
/var/www/true/vendor/symfony/console/Command/Command.php:254
/var/www/true/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
/var/www/true/vendor/symfony/console/Application.php:846
/var/www/true/vendor/symfony/console/Application.php:190
/var/www/true/vendor/symfony/console/Application.php:121
/var/www/true/vendor/laravel/framework/src/Illuminate/Console/Application.php:64
/var/www/true/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:159
/var/www/true/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:217
/var/www/true/tests/PluginTestCase.php:151
/var/www/true/tests/PluginTestCase.php:74
Whilst attempted to debug the error, I've found that my plugin which I'm testing, Daykin.True, is being disabled which is why the plugin refresh fails.
I've debugged PluginTestCase.php at line 150 before Artisan::call('plugin:refresh', ['name' => $code]); is executed with the following:
// $code = 'Daykin.True'
dump(PluginManager::instance()->isDisabled($code)); // false
My plugin requires 'rainlab.blog' as a dependency using the public $require property in my plugin, so the above debug prints out false twice as any plugin dependencies are refreshed first.
Finally, if I print out the same debug code in PluginRefresh.php before line 43 where the Exception is thrown, it returns false for Rainlab.Blog then true for Daykin.True - indicating my plugin is disabled.
Any help would be greatly appreciated!
I've now solved this.
Be sure to declare you plugin dependencies in correct camel case - otherwise your plugin will be disabled automatically!
['rainlab.blog'] // nope
['RainLab.Blog'] // yep
This will be fixed in Build 389 onwards: Plugin dependency definitions will no longer be case sensitive.
Commit reference: https://github.com/octobercms/october/commit/e8ba7fef5b22f4e02d12bcd608c1742133b68835
following the documentation, i must be missing something, i have this error
php vendor/bin/phpunit
PHPUnit 4.7.7-1-g3467f3b by Sebastian Bergmann and contributors.
Cannot open file "/Users/abcd/Sites/project/site/plugins/acme/project/../../../tests/bootstrap.php".
1-5 of 5