Make a better database interactions

This commit is contained in:
2017-08-31 15:09:43 +07:00
parent a075e1c36e
commit 031a188f5b
3 changed files with 24 additions and 18 deletions

View File

@@ -7,18 +7,25 @@ class PostTest extends \PHPUnit\Framework\TestCase
*
* @test
*/
public function showDataSuccess()
public function databaseInteractionsSuccess()
{
$post = new Post();
$this->assertTrue($post->showAll());
$fields = ['category', 'expired_at', 'creator', 'content'];
$values = ['3', '2017-09-02', '2', 'barbarbarbarbarbarbar!'];
$args = [
'category' => 3,
'expired_at' => '2017-09-02',
'creator' => 2,
'content' => 'barbarbarbarbarbarbar!'
];
$this->assertTrue($post->entry($fields, $values));
$this->assertTrue($post->entry($args));
$args = ['category' => 5, 'content' => 'foofoofoofoo!'];
$args = [
'category' => 5,
'content' => 'foofoofoofoo!'
];
$this->assertTrue($post->update($args, 1));