Hi everyone!
I have a quite strange issue which I cannot solve unfortunately, I will try to explain it as clear as possible.
We are migrating a older version of silverstripe, 2.4 to 3.1 exactly.
For testing this issue, I also have another fresh install of silverstripe 3.1. Let's call them Site A, and Site B.
Site A (already updated from silverstripe 2.4):
File /mysite/code/MyPage.php
class MyPage extends Page {
// ...
public function myFunction() { die('hey yo!'); }
// ...
}
class MyPage_Controller extends Page_Controller {
// ...
public function doSomething() {
$this->myFunction(); // the variable $this, should access the MyPage model, right? With some kind of magic related with Object::__call() magic method... and so on
}
// ...
}
File /mysite/tests/MyPageTest.php
class MyPageControllerTest extends FunctionalTest {
protected $_page;
public function setUp() {
parent::setUp();
$this->_page = new MyPage_Controller;
}
public function testDoSomething() {
$this->_page->doSomething(); // it's not really a test, I know, I m just executing it to illustrate the issue
}
}
Navigating to the corresponding url, it works, and I can see a blank page with my message 'hey yo!', Happy ending!
Navigating to /dev/test/MyPageControllerTest, it does not work, I m getting the error
[User Error] Uncaught Exception: Object->__call(): the method 'dosomething' does not exist on 'MyPage_Controller'
Site B (just a fresh from scratch silverstripe install):
Exaclty the same code as above:
Navigating to the corresponding url, it does not work, I m getting the error
[User Error] Uncaught Exception: Object->__call(): the method 'dosomething' does not exist on 'MyPage_Controller'
Navigating to /dev/test/MyPageControllerTest, it does not work, I m getting the error
[User Error] Uncaught Exception: Object->__call(): the method 'dosomething' does not exist on 'MyPage_Controller'
What am I missing? :(
I hope I explained myself clearly enough.
Thanks!