- 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.
This commit is contained in:
2017-09-04 10:37:25 +07:00
parent 58264e39db
commit 62430ff905
5 changed files with 165 additions and 198 deletions

View File

@@ -13,23 +13,23 @@ class AccessTest extends \PHPUnit\Framework\TestCase
$this->assertTrue($access->showAll());
$args = [
$user_entry = [
'username' => 'gregorio',
'password' => 'iniada13charc',
];
$this->assertTrue($access->entry($args));
$this->assertTrue($access->entry('user', $user_entry));
$args = [
$user_update = [
'username' => 'masihgregorio',
'password' => 'inijuga3belas'
];
$this->assertTrue($access->update($args, 1));
$this->assertTrue($access->update('user', $user_update, 1));
$this->assertTrue($access->showSingle(1));
$this->assertTrue($access->delete(1));
$this->assertTrue($access->delete('user', 1));
$this->assertTrue($access->dropTable('user'));
}

View File

@@ -13,26 +13,38 @@ class PostTest extends \PHPUnit\Framework\TestCase
$this->assertTrue($post->showAll());
$args = [
$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($args));
$this->assertTrue($post->entry('pengumuman', $post_entry));
$args = [
'category' => 5,
$post_update = [
'category' => 2,
'content' => 'foofoofoofoo!'
];
$this->assertTrue($post->update($args, 1));
$this->assertTrue($post->update('pengumuman', $post_update, 1));
$this->assertTrue($post->showSingle(1));
$this->assertTrue($post->delete(1));
$this->assertTrue($post->delete('pengumuman', 1));
$this->assertTrue($post->dropTable('pengumuman'));
$this->assertTrue($post->dropTable(['pengumuman', 'kategori']));
}
}