• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP UnitTester类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testAccessoryAdd

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


示例17: testManufacturerAdd

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


示例18: testProcessProlog

 public function testProcessProlog()
 {
     $I = $this->tester;
     $this->tester->wantToTest("processing the prolog and importing the file into the database");
     $this->import->setCsvReader($this->import->file);
     $this->import->processProlog();
     $prolog = $this->import->prolog;
     $this->assertEquals(14, count($prolog['columns']), "There are the correct number of columns");
     $this->assertEquals(6, count($prolog['prefix']), "There are the correct number of prefix entries");
     $this->assertEquals(10, count($prolog['meta']), "There are the correct number of meta entries");
     $this->import->getDataColumnIds();
     $this->import->processData();
     $results = $this->import->results['success'];
     verify(
       "There were 8 rows processed",
       count($results['rows'])
     )->equals(12);
     $this->import->processParents();
     $I->seeRecordCountInDatabaseTable("SchemaPropertyElement", 138);
     $I->seeRecordCountInDatabaseTable("SchemaProperty", 12);
     //prolog namespace entries are readable
     //prolog headers are actually in row 1
     //prolog headers not in row 1 produce fatal error (logged)
     //prolog entries can be matched to database (column uri matched to profile id)
     //prolog entries that can't be matched produce fatal error (logged)
 } //
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:26,代码来源:importTest.php


示例19: testWrongDates

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


示例20: testAssetAdd

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP UniteBaseClassRev类代码示例发布时间:2022-05-23
下一篇:
PHP UnitTestCase类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap