Skip to content

Fix routes related issue in controller tests #9

@ravage84

Description

@ravage84

Currently, if executed as standalone plugin, the tests for the CakePHP 3.x compatible 2.x branch of this plugin crashes with:

include(D:\dev\xampp\htdocs\cakephp-heartbeat\vendor\cakephp\cakephp\tests\test_app\config\routes.php): failed to open stream: No such file or directory
 D:\dev\xampp\htdocs\cakephp-heartbeat\vendor\cakephp\cakephp\src\Routing\Router.php:1170
 D:\dev\xampp\htdocs\cakephp-heartbeat\vendor\cakephp\cakephp\src\Routing\Router.php:1170
 D:\dev\xampp\htdocs\cakephp-heartbeat\vendor\cakephp\cakephp\src\Routing\Router.php:610
 D:\dev\xampp\htdocs\cakephp-heartbeat\vendor\cakephp\cakephp\src\TestSuite\LegacyRequestDispatcher.php:53
 D:\dev\xampp\htdocs\cakephp-heartbeat\vendor\cakephp\cakephp\src\TestSuite\IntegrationTestCase.php:491
 D:\dev\xampp\htdocs\cakephp-heartbeat\vendor\cakephp\cakephp\src\TestSuite\IntegrationTestCase.php:375
 D:\dev\xampp\htdocs\cakephp-heartbeat\tests\TestCase\Controller\HeartbeatControllerTest.php:22

It seems, we need to overwrite the CONFIG constant as some of the other plugins do:

https://github.com/FriendsOfCake/cakephp-upload/blob/master/tests/bootstrap.php
https://github.com/FriendsOfCake/crud/blob/master/tests/bootstrap.php
https://github.com/FriendsOfCake/bootstrap-ui/blob/master/tests/bootstrap.php
https://github.com/FriendsOfCake/search/blob/master/tests/bootstrap.php
https://github.com/FriendsOfCake/crud-view/blob/master/tests/bootstrap.php

May be there is a cleaner way. Also it would be nice to only overwrite the CONFIG constant without having to set all the others, too.

//cc @liviascapin

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions