lepisi-pengumuman/_tests/unit/PostTest.php
Gregorio Chiko Putra 62430ff905 - Methods that are same (e.g. entry(), update(), delete(), etc.) defined in the parent.
- Added function when entry multiple rows (in this case is when putting
categories).
- Do test.
2017-09-04 10:37:25 +07:00

51 lines
1.2 KiB
PHP

<?php
namespace App\Models;
class PostTest extends \PHPUnit\Framework\TestCase
{
/**
*
* @test
*/
public function databaseInteractionsSuccess()
{
$post = new Post();
$this->assertTrue($post->showAll());
$category_entry = [
'category' => 'Akademik,Jadwal,Dosen'
];
$this->assertTrue($post->entry('kategori', $category_entry));
$category_update = [
'category' => 'Akakademik'
];
$this->assertTrue($post->update('kategori', $category_update, 1));
$post_entry = [
'category' => 3,
'expired_at' => '2017-09-02',
'creator' => 2,
'content' => 'barbarbarbarbarbarbar!'
];
$this->assertTrue($post->entry('pengumuman', $post_entry));
$post_update = [
'category' => 2,
'content' => 'foofoofoofoo!'
];
$this->assertTrue($post->update('pengumuman', $post_update, 1));
$this->assertTrue($post->showSingle(1));
$this->assertTrue($post->delete('pengumuman', 1));
$this->assertTrue($post->dropTable(['pengumuman', 'kategori']));
}
}