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


PHP UnitTester::assertFalse方法代码示例

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


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

示例1: 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

示例2: testHasMethod

 public function testHasMethod()
 {
     $arrayer = new \Mascame\Arrayer\Arrayer([]);
     $arrayer->set('fruit', 'coconut');
     $this->tester->assertTrue($arrayer->has('fruit'));
     $this->tester->assertFalse($arrayer->has('something-else'));
 }
开发者ID:maniakphp,项目名称:arrayer,代码行数:7,代码来源:ArrayerTest.php

示例3: 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

示例4: 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

示例5: testProperties

 /**
  * @depends testInstall
  */
 public function testProperties()
 {
     $object_id = 3;
     //1. Add TAG taxonomy
     $term = new TaxonomyDef();
     $term->name = 'test_property';
     $term->class = PropertyTerm::className();
     $term->data_table = 'sample_property';
     $term->ref_table = SampleTable::className();
     $this->tester->assertTrue($term->save());
     //2. Create data table
     $this->tester->assertFalse($this->getTaxonomy()->getTerm($term->name)->isInstalled(), 'The term should NOT be installed.');
     $this->getTaxonomy()->getTerm($term->name)->install();
     $this->tester->assertTrue($this->getTaxonomy()->getTerm($term->name)->isInstalled(), 'The term should be installed.');
     //3. Add some data
     $this->getTaxonomy()->addTerm($term->name, $object_id, ['prop1' => 'value1', 'prop2' => 'value2']);
     $term->refresh();
     //check count on term
     $this->tester->assertEquals(2, $term->total_count, 'Tag term count not correct!');
     //check update of field
     $this->getTaxonomy()->addTerm($term->name, $object_id, ['prop1' => 'value1_update']);
     $data = $this->getTaxonomy()->getTerms($term->name, $object_id);
     $this->tester->assertEquals('value1_update', $data['prop1'], 'Property value not updated');
     // 4. Test PropertyTerm::setTerms()
     $term = $this->getTaxonomy()->getTerm($term->name);
     $term->setTerms($object_id, ['prop1' => 'value1', 'prop3' => 'value3']);
     $data = $term->getTerms($object_id);
     $this->tester->assertTrue(array_key_exists('prop1', $data), 'Property prop1 is missing');
     $this->tester->assertTrue(array_key_exists('prop3', $data), 'Property prop3 is missing');
     $this->tester->assertFalse(array_key_exists('prop2', $data), 'Property prop2 must not be here');
     // 5. Test PropertyTerm::removeTerm()
     $term->removeTerm($object_id, array_keys($data));
     $data = $term->getTerms($object_id);
     $this->tester->assertEmpty($data, 'Data must be empty');
 }
开发者ID:nkostadinov,项目名称:yii2-taxonomy,代码行数:38,代码来源:TaxonomyTest.php

示例6: tryToCompareIdenticalChunks

 public function tryToCompareIdenticalChunks(UnitTester $I)
 {
     /** @var \Modvert\Resource\Modx\Chunk $r1 */
     /** @var \Modvert\Resource\Modx\Chunk $r2 */
     $r1 = $I->createChunk();
     $r2 = $I->createChunk();
     $ch = \Modvert\Comparator\ComparatorFactory::get(\Modvert\Resource\ResourceType::CHUNK)->compare($r1, $r2);
     $I->assertFalse($ch);
 }
开发者ID:JasperGrimm,项目名称:modvert2,代码行数:9,代码来源:ResourceCest.php

示例7: UnitTester

<?php

use BB\Entities\Payment;
use BB\Entities\User;
$I = new UnitTester($scenario);
$I->wantTo('confirm the payment helper fetches the correct payment date');
//Create a user record
$user = User::create(['given_name' => 'Test', 'family_name' => 'Person', 'email' => 'testperson@example.com']);
$date = \BB\Helpers\MembershipPayments::lastUserPaymentDate($user->id);
$I->assertFalse($date, 'Date should be false as no payments exist');
//Create some payment records
\BB\Entities\SubscriptionCharge::create(['user_id' => $user->id, 'charge_date' => '2014-01-01', 'payment_date' => '2014-01-01', 'status' => 'paid']);
Payment::create(['reason' => 'subscription', 'source' => 'other', 'user_id' => $user->id, 'amount' => 20, 'amount_minus_fee' => 20, 'status' => 'paid', 'created_at' => '2014-01-01']);
\BB\Entities\SubscriptionCharge::create(['user_id' => $user->id, 'charge_date' => '2014-06-01', 'status' => 'processing']);
Payment::create(['reason' => 'subscription', 'source' => 'other', 'user_id' => $user->id, 'amount' => 20, 'amount_minus_fee' => 20, 'status' => 'pending', 'created_at' => '2014-06-01']);
\BB\Entities\SubscriptionCharge::create(['user_id' => $user->id, 'charge_date' => '2014-08-01', 'status' => 'cancelled']);
Payment::create(['reason' => 'subscription', 'source' => 'other', 'user_id' => $user->id, 'amount' => 20, 'amount_minus_fee' => 20, 'status' => 'cancelled', 'created_at' => '2014-08-01']);
//Now we have some payments re-fetch the last payment date
$date = \BB\Helpers\MembershipPayments::lastUserPaymentDate($user->id);
//Make sure its a date that's returned
$I->assertEquals(get_parent_class($date), 'DateTime');
//Confirm the datetime matched the first payment record, the only paid one
$I->assertEquals(new \Carbon\Carbon('2014-01-01'), $date);
开发者ID:adamstrawson,项目名称:BBMembershipSystem,代码行数:23,代码来源:PaymentHelperCept.php

示例8: testCategories

 public function testCategories()
 {
     // 1. Add category taxonomy
     $taxonomy = new TaxonomyDef();
     $taxonomy->name = 'test_categories';
     $taxonomy->class = CategoryTerm::className();
     $taxonomy->data_table = 'sample_categories';
     $taxonomy->ref_table = SampleTable::className();
     // 2. Create data table
     $categoryTerm = Yii::createObject($taxonomy->attributes);
     $migration = $categoryTerm->install();
     $this->runMigration($migration);
     $categoryTerm = $this->getTaxonomy()->getTerm($taxonomy->name);
     $this->tester->assertTrue($categoryTerm->isInstalled(), 'The taxonomy must be installed.');
     // 3. Add a root category without an object id
     $rootTermName = 'root';
     $categoryTerm->addTerm(null, [$rootTermName]);
     $categoryTerm = $this->getTaxonomy()->getTerm($taxonomy->name, true);
     $rootTerm = $categoryTerm->getTaxonomyTerm($rootTermName);
     $terms = $categoryTerm->getTerms(null);
     // Check whether everything is properly inserted
     $this->tester->assertEquals(0, $categoryTerm->total_count);
     $this->tester->assertEquals(0, $rootTerm->total_count);
     $this->tester->assertEquals(1, count($terms));
     $this->tester->assertEquals($rootTermName, $terms[0]);
     // Check for parents
     $this->tester->assertNull($categoryTerm->getParent($terms[0]));
     $this->tester->assertFalse($categoryTerm->hasParent($terms[0]));
     // Check for children
     $this->tester->assertEmpty($categoryTerm->getChildren($terms[0]));
     $this->tester->assertFalse($categoryTerm->hasChildren($terms[0]));
     // 4. Add child to the root
     $childTermName1 = 'child1';
     $categoryTerm->addTerm(null, [$rootTermName => $childTermName1]);
     $categoryTerm = $this->getTaxonomy()->getTerm($taxonomy->name, true);
     $childTerm1 = $categoryTerm->getTaxonomyTerm($childTermName1);
     $terms = $categoryTerm->getTerms(null);
     // Check whether everything is properly inserted
     $this->tester->assertEquals(0, $categoryTerm->total_count);
     $this->tester->assertEquals(0, $childTerm1->total_count);
     $this->tester->assertEquals(2, count($terms));
     $this->tester->assertContains($childTermName1, $terms);
     // Check for parents
     $this->tester->assertTrue($categoryTerm->hasParent($childTermName1));
     $this->tester->assertEquals($rootTermName, $categoryTerm->getParent($childTermName1));
     // Check for children
     $this->tester->assertEmpty($categoryTerm->getChildren($childTermName1));
     $this->tester->assertFalse($categoryTerm->hasChildren($childTermName1));
     // Check the children of the root
     $rootChildren = $categoryTerm->getChildren($rootTermName);
     $this->tester->assertTrue($categoryTerm->hasChildren($rootTermName));
     $this->tester->assertEquals(1, count($rootChildren));
     $this->tester->assertContains($childTermName1, $rootChildren);
     // 5. Test adding more than one child at a time
     $childTermName2 = 'child2';
     $childTermName3 = 'child3';
     $categoryTerm->addTerm(null, [$rootTermName => [$childTermName2, $childTermName3]]);
     $categoryTerm = $this->getTaxonomy()->getTerm($taxonomy->name, true);
     $terms = $categoryTerm->getTerms(null);
     // Test whether all child terms are attached to the root
     $this->tester->assertEquals(4, count($terms));
     $this->tester->assertEquals(3, count($categoryTerm->getChildren($rootTermName)));
     // 6. Test adding term to an existing object
     $rootTermName2 = 'root2';
     $categoryTerm->addTerm(1, $rootTermName2);
     // Add a term as a string, not as an array
     $categoryTerm = $this->getTaxonomy()->getTerm($taxonomy->name, true);
     $rootTerm2 = $categoryTerm->getTaxonomyTerm($rootTermName2);
     // Check whether everything is properly inserted
     $terms = $categoryTerm->getTerms(1);
     $this->tester->assertEquals(1, count($terms));
     $this->tester->assertContains($rootTermName2, $terms);
     // Check the counters
     $this->tester->assertEquals(1, $categoryTerm->total_count);
     $this->tester->assertEquals(1, $rootTerm2->total_count);
     // Check whether all terms will be returned
     $terms = $categoryTerm->getTerms(null);
     $this->tester->assertEquals(5, count($terms));
     // Add child
     $childTermName4 = 'child4';
     $categoryTerm->addTerm(1, [$rootTermName2 => $childTermName4]);
     $categoryTerm = $this->getTaxonomy()->getTerm($taxonomy->name, true);
     $rootTerm2 = $categoryTerm->getTaxonomyTerm($rootTermName2);
     $childTerm4 = $categoryTerm->getTaxonomyTerm($childTermName4);
     $terms = $categoryTerm->getTerms(1);
     $this->tester->assertEquals(2, count($terms));
     $this->tester->assertEquals(2, $categoryTerm->total_count);
     $this->tester->assertEquals(1, $rootTerm2->total_count);
     $this->tester->assertEquals(1, $childTerm4->total_count);
     // 7. Loop detection test. Add the root as a child of one of the children
     $exceptionTrown = false;
     try {
         $categoryTerm->addTerm(null, [$childTermName3 => $rootTermName]);
     } catch (Exception $ex) {
         $exceptionTrown = true;
     }
     $this->tester->assertTrue($exceptionTrown);
     // 8. Adding two hierarchies at once
     TaxonomyTerms::deleteAll();
     $categoryTerm->addTerm(null, [$rootTermName => [$childTermName1, $childTermName2], $rootTermName2]);
//.........这里部分代码省略.........
开发者ID:traykovn,项目名称:yii2-taxonomy,代码行数:101,代码来源:TaxonomyTest.php


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