Hi, I'm new in unit testing. But I trying to test every plugin I have made by following this doc. But I got the following error when running phpunit in the base plugin directory;
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.
E
Time: 3.53 seconds, Memory: 23.25Mb
There was 1 error:
1) Rahman\Forum\Tests\Models\TopicTest::testCreateTopic
Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1 no such table: users (SQL: select * from "users" where "users"."deleted_at" is null)
...
Caused by
PDOException: SQLSTATE[HY000]: General error: 1 no such table: users
...
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
and my test file code is TopicTest.php.
<?php namespace Rahman\Forum\Tests\Models;
use Rahman\Forum\Models\Topic;
use PluginTestCase;
class TopicTest extends PluginTestCase
{
public function testCreateTopic()
{
$topic = Topic::create(['subject' => 'New topic!']);
$this->assertEquals(1, $topic->id);
}
}
Am I missed something?
Thanks
Last updated