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


PHP UnitTester::assertNotContains方法代码示例

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


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

示例1: testGetAuthUrlWithoutStateAndPermissions

 public function testGetAuthUrlWithoutStateAndPermissions()
 {
     $url = $this->facebook->getAuthUrl();
     $this->tester->assertNotEmpty($url);
     $this->tester->assertNotContains('&state', $url);
     $this->tester->assertContains('&scope', $url);
     $this->tester->assertContains(implode(',', $this->facebook->default_permissions), $url);
 }
开发者ID:soutoner,项目名称:api-desconecta,代码行数:8,代码来源:FacebookTest.php

示例2: testTags

 /**
  * @depends testInstall
  */
 public function testTags()
 {
     $object_id = 2;
     //1. Add TAG taxonomy
     $term = new TaxonomyDef();
     $term->name = 'test_tag';
     $term->class = TagTerm::className();
     $term->data_table = 'sample_tags';
     $term->ref_table = SampleTable::className();
     //2. Create data table
     $tagTerm = Yii::createObject($term->attributes);
     $migration = $tagTerm->install();
     $this->runMigration($migration);
     $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, ['tag1', 'tag2']);
     $term = $this->getTaxonomy()->getTerm($term->name, true);
     //check count on term
     $this->tester->assertEquals(2, $term->total_count, "Tag term count not correct ({$term->total_count})!");
     $data = $this->getTaxonomy()->getTerms($term->name, $object_id);
     // tag1 + tag2
     $this->tester->assertEquals(2, count($data), 'Tag term count not correct!');
     $this->tester->assertContains('tag1', $data, 'Tag1 missing in data');
     $this->tester->assertContains('tag2', $data, 'Tag1 missing in data');
     $this->getTaxonomy()->removeTerm($term->name, $object_id, ['name' => 'tag1']);
     $data = $this->getTaxonomy()->getTerms($term->name, $object_id);
     // tag1 + tag2
     $this->tester->assertEquals(1, count($data), 'Tag term count not correct!');
     $this->tester->assertNotContains('tag1', $data, 'Tag1 present in data');
     $this->tester->assertContains('tag2', $data, 'Tag1 missing in data');
     $this->getTaxonomy()->removeTerm($term->name, $object_id);
     $data = $this->getTaxonomy()->getTerms($term->name, $object_id);
     // tag1 + tag2
     $this->tester->assertEmpty($data, 'Tag term data not correct!');
     $this->tester->assertNotContains('tag1', $data, 'Tag1 present in data');
     // 4. setTerms() test
     $term->addTerm($object_id, ['tag1', 'tag2']);
     // Add new terms
     $term->setTerms($object_id, ['tag1', 'tag3', 'tag4']);
     // Overwrite all terms of this object
     $data = $term->getTerms($object_id);
     $this->tester->assertEquals(3, count($data), 'Wrong term count!');
     $this->tester->assertContains('tag1', $data, 'Tag1 missing in data');
     $this->tester->assertContains('tag3', $data, 'Tag3 missing in data');
     $this->tester->assertContains('tag4', $data, 'Tag4 missing in data');
     $this->tester->assertNotContains('tag2', $data, 'Tag2 must not be present in data');
     // 5. getTerms test
     $data = $term->getTerms($object_id);
     // Get all terms of the given object
     $this->tester->assertEquals(3, count($data), 'Wrong term count!');
     $data = $term->getTerms();
     // Get all terms currently present in the system
     $this->tester->assertEquals(4, count($data), 'Wrong term count!');
 }
开发者ID:nkostadinov,项目名称:yii2-taxonomy,代码行数:57,代码来源:TaxonomyTest.php


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