This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
chrisiek
I want to make a simple phpunit test but something goes wrong.
...
<testsuites>
<testsuite name="MyPlugin Test">
<directory>./plugins/myplugin/userext/tests</directory>
</testsuite>
</testsuites>
...
use PluginTestCase;
class MyTest extends PluginTestCase
{
protected $baseUrl = 'http://mysite.dev';
public function testDisplaySite()
{
$this->visit('/');
dd($this->response);
}
}
Among other page details I am still getting this wrong content:
My Webpage
. That is not a page I am requesting....
#content: "<h1>My Webpage</h1>"
#version: "1.1"
#statusCode: 200
#statusText: "OK"
#charset: null
...
Last updated
chrisiek
It looks like during unit tests the theme is not recognized.
1) Mydev\UserExt\Tests\Models\PostTest::testDisplaysAlpha
A request to [https://mydev.com/test] failed. Received status code [500].
/home/vagrant/Code/Projects/mydev/vendor/laravel/framework/src/Illuminate/Foundation/Testing/InteractsWithPages.php:165
/home/vagrant/Code/Projects/mydev/vendor/laravel/framework/src/Illuminate/Foundation/Testing/InteractsWithPages.php:63
/home/vagrant/Code/Projects/mydev/vendor/laravel/framework/src/Illuminate/Foundation/Testing/InteractsWithPages.php:44
/home/vagrant/Code/Projects/mydev/plugins/mydev/userext/tests/PostTest.php:23
Caused by
exception 'Cms\Classes\CmsException' with message 'The active theme is not found.' in /home/vagrant/Code/Projects/mydev/modules/cms/Classes/Controller.php:126
Setting 'activeTheme' => 'mytheme2', in cms.htm causes no results.
Last updated
chrisiek
This change in config/testing/cms.php solved my problem.
//'themesPathLocal' => base_path('tests/fixtures/themes'),
'themesPathLocal' => base_path('themes'),
1-3 of 3