I am trying to run some unit tests in CakePHP 3.0 but keep getting the following errors, which seem to be more Cake problems than one I constructed myself? Anyone have a similar issue? Test code is following samle in this article: http://book.cakephp.org/3.0/en/development/testing.html
namespace App\Test\TestCase\Controller;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\IntegrationTestCase;
/**
* App\Controller\UsersController Test Case
*/
class UsersControllerTest extends IntegrationTestCase
{
/**
* Test add method
*
* @return void
*/
public function testAdd()
{
$data = [
'username' => 'testusername',
'password' => 'testpassword',
'email' => 'testemail@test.ie',
'location_id' => 5,
'gender' => 'Male',
'info' => 'test info'
];
$this->post('/users', $data);
$this->assertResponseSuccess();
$users = TableRegistry::get('Users');
$query = $users->find()->where(['username' => $data['username']]);
$this->assertEquals(1, $query->count());
}
Response:
1) App\Test\TestCase\Controller\UsersControllerTest::testIndex
Use of undefined constant TMP - assumed 'TMP'
C:\wamp\www\mysite\vendor\cakephp\cakephp\src\Network\Session.php:141
C:\wamp\www\mysite\vendor\cakephp\cakephp\src\Network\Session.php:95
C:\wamp\www\mysite\vendor\cakephp\cakephp\src\TestSuite\IntegrationTestCas
e.php:340
C:\wamp\www\mysite\vendor\cakephp\cakephp\src\TestSuite\IntegrationTestCas
e.php:267
C:\wamp\www\mysite\vendor\cakephp\cakephp\src\TestSuite\IntegrationTestCas
e.php:188