當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UnitTester::grabRecord方法代碼示例

本文整理匯總了PHP中UnitTester::grabRecord方法的典型用法代碼示例。如果您正苦於以下問題:PHP UnitTester::grabRecord方法的具體用法?PHP UnitTester::grabRecord怎麽用?PHP UnitTester::grabRecord使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnitTester的用法示例。


在下文中一共展示了UnitTester::grabRecord方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testForumDelete

 public function testForumDelete()
 {
     $this->create();
     $before = $this->tester->grabRecord('forums', ['name' => 'B']);
     Forum::where('name', 'A')->delete();
     $after = $this->tester->grabRecord('forums', ['name' => 'B']);
     $this->assertEquals($before->order - 1, $after->order);
 }
開發者ID:furious-programming,項目名稱:coyote,代碼行數:8,代碼來源:ForumTest.php

示例2: testAlertDelete

 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]);
 }
開發者ID:furious-programming,項目名稱:coyote,代碼行數:9,代碼來源:AlertTest.php

示例3: testPrivateMessageDelete

 public function testPrivateMessageDelete()
 {
     $pm = $this->create();
     $pm->delete();
     $user = $this->tester->grabRecord('users', ['id' => $this->user->id]);
     $this->assertEquals(0, $user->pm);
     $this->assertEquals(0, $user->pm_unread);
     // jeden rekord powinien byc w bazie danych...
     $this->tester->seeRecord('pm', ['root_id' => $pm->root_id]);
 }
開發者ID:furious-programming,項目名稱:coyote,代碼行數:10,代碼來源:PmTest.php

示例4: testAssignUserToNewGroup

 public function testAssignUserToNewGroup()
 {
     $this->testCreationNewGroup();
     $user = User::first();
     $group = $this->tester->grabRecord('groups', ['name' => 'Grupa AA']);
     DB::table('group_users')->insert(['user_id' => $user->id, 'group_id' => $group->id]);
     $this->testCreationNewPermission();
     $permission = $this->tester->grabRecord('permissions', ['name' => 'do-smth']);
     $this->tester->seeRecord('group_permissions', ['group_id' => $group->id, 'permission_id' => $permission->id, 'value' => false]);
 }
開發者ID:furious-programming,項目名稱:coyote,代碼行數:10,代碼來源:PermissionTest.php

示例5: testTopicMove

 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]);
 }
開發者ID:furious-programming,項目名稱:coyote,代碼行數:11,代碼來源:TopicTest.php

示例6: testGetDocuments

 public function testGetDocuments()
 {
     Document::deleteAll();
     $this->specify("Attachment must be exist", function () {
         $numberId = $this->tester->haveRecord(Number::className(), ['number' => '9999999999']);
         $model = $this->tester->grabRecord(Number::className(), ['_id' => $numberId]);
         $model->attachDocument(\Yii::getAlias('@data') . '/file1.jpg');
         $model->attachDocument(\Yii::getAlias('@data') . '/file2.pdf');
         expect(count($model->documents))->equals(2);
         foreach ($model->documents as $document) {
             expect($document instanceof Document)->true();
             expect($document->ownerId)->equals($model->getPrimaryKey());
         }
     });
 }
開發者ID:shubnikofff,項目名稱:mobiles,代碼行數:15,代碼來源:NumberTest.php


注:本文中的UnitTester::grabRecord方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。