示例#1
0
 public function testRoleCanBeDeleted()
 {
     $id = $this->tester->haveRecord('roles', ['role_name' => 'user']);
     $role = \ChopBox\Role::find($id);
     $role->delete();
     $this->tester->dontSeeRecord('roles', ['role_name' => 'user']);
 }
示例#2
0
 public function testUploadCanBeDeleted()
 {
     $chops_id = $this->createChops();
     $id = $this->tester->haveRecord('uploads', ['chops_id' => $chops_id, 'mime_type' => 'image/jpg', 'file_uri' => 'bla', 'name' => 'a name']);
     $upload = \ChopBox\Upload::find($id);
     $upload->delete();
     $this->tester->dontSeeRecord('uploads', ['name' => 'a name']);
 }
示例#3
0
 public function testChopsCanBeUnfavourited()
 {
     $chops_id = $this->createChops();
     $id = $this->tester->haveRecord('favourites', ['chops_id' => $chops_id]);
     $favourite = \ChopBox\Favourite::find($id);
     $favourite->delete();
     $this->tester->dontSeeRecord('favourites', ['chops_id' => $chops_id]);
 }
示例#4
0
 public function testCommentCanBeDeleted()
 {
     $chops_id = $this->createChops();
     $chops = \ChopBox\Chop::find($chops_id);
     $id = $this->tester->haveRecord('comments', ['comment' => "this comment has to be deleted", 'user_id' => $chops->user_id, 'chops_id' => $chops->id]);
     $comment = \ChopBox\Comment::find($id);
     $comment->delete();
     $this->tester->dontSeeRecord('comments', ['comment' => 'this comment has to be deleted']);
 }
示例#5
0
 public function testChopsCanBeUpdated()
 {
     $id = $this->createChops();
     $chops = Chop::find($id);
     $chops->chops_name = "A new name";
     $chops->save();
     $this->tester->seeRecord('chops', ['chops_name' => 'A new name']);
     $this->tester->dontSeeRecord('chops', ['chops_name' => 'Random name']);
 }
示例#6
0
 public function testCompleteRemovingFromDatabase()
 {
     $pm = $this->create();
     $pm->delete();
     // jeden rekord powinien byc w bazie danych...
     $this->tester->seeRecord('pm_text', ['id' => $pm->text_id]);
     Pm::where('root_id', $pm->root_id)->delete();
     $this->tester->dontSeeRecord('pm_text', ['id' => $pm->text_id]);
 }
示例#7
0
 public function testAlertDelete()
 {
     $alert = $this->create();
     $alert->delete();
     $user = $this->tester->grabRecord('users', ['id' => $this->user->id]);
     $this->assertEquals(0, $user->alerts);
     $this->assertEquals(0, $user->alerts_unread);
     $this->tester->dontSeeRecord('alerts', ['object_id' => $alert->object_id]);
 }
示例#8
0
 public function testTopicMove()
 {
     $fake = Factory::create();
     $topic = $this->create();
     $this->assertEquals(1, $this->tester->grabRecord('forums', ['id' => $this->forum->id])->topics);
     $newForum = Forum::create(['name' => $fake->name, 'path' => $fake->name, 'description' => 'Lorem ipsum']);
     $topic->forum_id = $newForum->id;
     $topic->save();
     $this->assertEquals(1, $this->tester->grabRecord('forums', ['id' => $newForum->id])->topics);
     $this->tester->dontSeeRecord('posts', ['forum_id' => $this->forum->id]);
 }