当前位置: 首页>>代码示例>>PHP>>正文


PHP UnitTester类代码示例

本文整理汇总了PHP中UnitTester的典型用法代码示例。如果您正苦于以下问题:PHP UnitTester类的具体用法?PHP UnitTester怎么用?PHP UnitTester使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UnitTester类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testUserAdd

 public function testUserAdd()
 {
     $user = factory(User::class, 'valid-user')->make();
     $values = ['first_name' => $user->first_name, 'last_name' => $user->last_name, 'email' => $user->email, 'username' => $user->username, 'password' => $user->password];
     User::create($values);
     $this->tester->seeRecord('users', $values);
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:7,代码来源:UserTest.php

示例2: testAssetAdd

 public function testAssetAdd()
 {
     $company = factory(Company::class, 'company')->make();
     $values = ['name' => $company->name];
     Company::create($values);
     $this->tester->seeRecord('companies', $values);
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:7,代码来源:CompanyTest.php

示例3: testAssetAdd

 public function testAssetAdd()
 {
     $location = factory(Location::class, 'location')->make();
     $values = ['name' => $location->name];
     Location::create($values);
     $this->tester->seeRecord('locations', $values);
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:7,代码来源:LocationTest.php

示例4: testLostStatuslabelAdd

 public function testLostStatuslabelAdd()
 {
     $statuslabel = factory(Statuslabel::class, 'lost')->make();
     $values = ['name' => $statuslabel->name];
     Statuslabel::create($values);
     $this->tester->seeRecord('status_labels', $values);
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:7,代码来源:StatuslabelTest.php

示例5: testLiking

 public function testLiking()
 {
     $idUser1 = 1;
     $idUser2 = 2;
     $idUser3 = 3;
     $idUser4 = 4;
     $photoidUser1 = 1;
     $photoidUser2 = 4;
     $photoidUser3 = 8;
     $photoidUser4 = 11;
     // User should be able to like photos they don't own
     list($result_code, $result) = User::likePhoto($idUser1, $photoidUser2);
     $this->assertEquals(200, $result_code);
     $this->assertTrue($result['success'] == true);
     $this->assertTrue($result['likes'] == true);
     $this->tester->seeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => $photoidUser2]);
     // User should be able to unlike photos they don't own
     list($result_code, $result) = User::likePhoto($idUser1, $photoidUser2);
     $this->assertEquals(200, $result_code);
     $this->assertTrue($result['success'] == true);
     $this->assertTrue($result['likes'] == false);
     $this->tester->dontSeeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => $photoidUser2]);
     // User should not be be able to like photos they own
     list($result_code, $result) = User::likePhoto($idUser1, $photoidUser1);
     $this->assertEquals(403, $result_code);
     $this->assertTrue($result['success'] == false);
     $this->tester->dontSeeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => $photoidUser1]);
     // User should not be be able to like photos that don't exist
     list($result_code, $result) = User::likePhoto($idUser1, 0);
     $this->assertEquals(404, $result_code);
     $this->assertTrue($result['success'] == false);
     $this->tester->dontSeeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => 0]);
 }
开发者ID:tom2320x,项目名称:list,代码行数:33,代码来源:UserPhotosLikeTest.php

示例6: testRoleCanBeDeleted

 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']);
 }
开发者ID:andela,项目名称:chopbox,代码行数:7,代码来源:RoleTest.php

示例7: testConsumableAdd

 public function testConsumableAdd()
 {
     $consumable = factory(Consumable::class, 'consumable')->make();
     $values = ['name' => $consumable->name, 'qty' => $consumable->qty, 'category_id' => $consumable->category_id, 'company_id' => $consumable->company_id];
     Consumable::create($values);
     $this->tester->seeRecord('consumables', $values);
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:7,代码来源:ConsumableTest.php

示例8: testAccessoryCategoryAdd

 public function testAccessoryCategoryAdd()
 {
     $category = factory(Category::class, 'accessory-category')->make();
     $values = ['name' => $category->name, 'category_type' => $category->category_type];
     Category::create($values);
     $this->tester->seeRecord('categories', $values);
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:7,代码来源:CategoryTest.php

示例9: testLostStatuslabelAdd

 public function testLostStatuslabelAdd()
 {
     $statuslabel = factory(Statuslabel::class, 'lost')->make();
     $values = ['name' => $statuslabel->name, 'deployable' => $statuslabel->deployable, 'pending' => $statuslabel->pending, 'archived' => $statuslabel->archived];
     Statuslabel::create($values);
     $this->tester->seeRecord('status_labels', $values);
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:7,代码来源:StatuslabelTest.php

示例10: testCreateWithoutFactory

 public function testCreateWithoutFactory()
 {
     $factory = new \WebChemistry\Forms\Factory\Container();
     $this->tester->assertExceptionThrown('WebChemistry\\Forms\\FormException', function () use($factory) {
         $factory->create();
     });
 }
开发者ID:webchemistry,项目名称:forms,代码行数:7,代码来源:ContainerTest.php

示例11: testAssetModelAdd

 public function testAssetModelAdd()
 {
     $assetmodel = factory(AssetModel::class, 'assetmodel')->make();
     $values = ['name' => $assetmodel->name, 'manufacturer_id' => $assetmodel->manufacturer_id, 'category_id' => $assetmodel->category_id, 'eol' => $assetmodel->eol];
     AssetModel::create($values);
     $this->tester->seeRecord('models', $values);
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:7,代码来源:AssetModelTest.php

示例12: createPlantWithColorForTest

 /**
  * @return mixed
  */
 public function createPlantWithColorForTest()
 {
     $plantID = $this->tester->haveRecord('plants', ['name' => 'test plant']);
     $colorArray = array("red" => "red", "yellow" => "yellow", "blue" => NULL, "green" => NULL, "brown" => NULL, "black" => NULL, "white" => NULL, "purple" => NULL, "orange" => NULL);
     $this->UUT->set($plantID, $colorArray);
     return $plantID;
 }
开发者ID:Opstrup,项目名称:naturens_spisekammer,代码行数:10,代码来源:colorHandlerTest.php

示例13: testWrongTimestamps

 public function testWrongTimestamps()
 {
     foreach ($this->bad_timestamps as $bad) {
         $this->modelWValidation->start_date = $bad;
         $this->tester->assertFalse($this->modelWValidation->save());
     }
 }
开发者ID:soutoner,项目名称:api-desconecta,代码行数:7,代码来源:TimestampTest.php

示例14: testSetUnit

 public function testSetUnit()
 {
     $metric = new Metric();
     $this->tester->assertFalse($metric->setUnit('Invalid'), 'Metric::setUnit invalid unit set failed!');
     $metric->setUnit('Kilobits/Second');
     $this->tester->assertEquals('Kilobits/Second', $metric->getUnit(), 'Metric::setUnit failed!');
 }
开发者ID:fustundag,项目名称:awscw-custom-metrics,代码行数:7,代码来源:MetricTest.php

示例15: testSupplierAdd

 public function testSupplierAdd()
 {
     $supplier = factory(Supplier::class, 'supplier')->make();
     $values = ['name' => $supplier->name];
     Supplier::create($values);
     $this->tester->seeRecord('suppliers', $values);
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:7,代码来源:SupplierTest.php


注:本文中的UnitTester类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。