本文整理汇总了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);
}
示例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!');
}