本文整理汇总了PHP中assertEquals函数的典型用法代码示例。如果您正苦于以下问题:PHP assertEquals函数的具体用法?PHP assertEquals怎么用?PHP assertEquals使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assertEquals函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_it_can_activate_a_language
public function test_it_can_activate_a_language()
{
$LanguageManager = new LanguagesManager(new \DvsLanguage());
$LanguageManager->modifyActiveFlag($id = 31, $isActive = true);
// the active flag should be true now...
assertEquals(true, \DvsLanguage::find(31)->active);
}
示例2: testCanVulgarizeStrings
public function testCanVulgarizeStrings()
{
$monkeyFighter = new MonkeyFighter('F**k MotherF*!ker S#!t P*$$! P**s Muthaf#$!ing C**KSUCKER NI**** N***A N*$@ah T**s T$$TYf**! A-- B--CH D*** F@G F@***t');
$dirty = $monkeyFighter->getVulgarized();
assertEquals('Fuck MotherFucker Shit Pussy Piss Muthafucking COCKSUCKER NIGGER NIGGA Niggah Tits TITTYfuck Ass BITCH Damn FAG Faggot', $dirty);
$monkeyFighter = new MonkeyFighter('Mother****** with the Hat');
$dirty = $monkeyFighter->getVulgarized();
assertEquals('Motherfucker with the Hat', $dirty);
$monkeyFighter = new MonkeyFighter('Mr. Muthaf**kin Exquire');
$dirty = $monkeyFighter->getVulgarized();
assertEquals('Mr. Muthafuckin Exquire', $dirty);
$monkeyFighter = new MonkeyFighter('F*CK F*ck f*ck');
$dirty = $monkeyFighter->getVulgarized();
assertEquals('FUCK Fuck fuck', $dirty);
$monkeyFighter = new MonkeyFighter('Starf**ker Startf**ker');
$dirty = $monkeyFighter->getVulgarized();
assertEquals('Starfucker Startfucker', $dirty);
$monkeyFighter = new MonkeyFighter('Hot Sh*t All Stars');
$dirty = $monkeyFighter->getVulgarized();
assertEquals('Hot Shit All Stars', $dirty);
$monkeyFighter = new MonkeyFighter('The F***ing Champs');
$dirty = $monkeyFighter->getVulgarized();
assertEquals('The Fucking Champs', $dirty);
$monkeyFighter = new MonkeyFighter('Goblin C*ck');
$dirty = $monkeyFighter->getVulgarized();
assertEquals('Goblin Cock', $dirty);
$monkeyFighter = new MonkeyFighter('F*cktard');
$dirty = $monkeyFighter->getVulgarized();
assertEquals('Fucktard', $dirty);
$monkeyFighter = new MonkeyFighter('Dane Cook Elizabeth Cook DC 101 Chili Cook-Off Bethune Cookman Wildcats Baseball');
$dirty = $monkeyFighter->getVulgarized();
assertEquals('Dane Cook Elizabeth Cook DC 101 Chili Cook-Off Bethune Cookman Wildcats Baseball', $dirty);
}
示例3: test_it_can_give_me_primary_language_id
public function test_it_can_give_me_primary_language_id()
{
$Config = m::mock('Illuminate\\Config\\Repository');
$Config->shouldReceive('get')->times(1)->andReturn(45);
$LanguageDetector = new LanguageDetector(new LocaleDetector($this->Framework), new \DvsLanguage(), $Config);
assertEquals(45, $LanguageDetector->primaryLanguageId());
}
示例4: testParse
/**
* @test
* @profile fork
*/
public function testParse()
{
split_time('Reset');
$annotations = Annotations::get('Components\\Type_Test_Unit_Case_Annotations_Entity');
split_time('Invoke Annotations::get(Components\\Type_Test_Unit_Case_Annotations_Entity)');
$annotations = Annotations::get('Components\\Type_Test_Unit_Case_Annotations_Entity');
split_time('Invoke Annotations::get(Components\\Type_Test_Unit_Case_Annotations_Entity)');
assertTrue($annotations->hasTypeAnnotation(Annotation_Name::NAME));
split_time('Invoke Annotations$hasMethodAnnotation(name)');
assertTrue($annotations->hasTypeAnnotation(Annotation_Name::NAME));
split_time('Invoke Annotations$hasMethodAnnotation(name)');
assertTrue($annotations->hasTypeAnnotation('package'));
split_time('Invoke Annotations$hasMethodAnnotation(package)');
assertFalse($annotations->hasTypeAnnotation('version'));
split_time('Invoke Annotations$hasMethodAnnotation(version)');
assertTrue($annotations->hasMethodAnnotation('poke', Annotation_Name::NAME));
split_time('Invoke Annotations$hasMethodAnnotation(poke)');
assertTrue($annotations->hasMethodAnnotation('poke', Annotation_Name::NAME));
split_time('Invoke Annotations$hasMethodAnnotation(poke)');
$pokeName = $annotations->getMethodAnnotation('poke', Annotation_Name::NAME);
split_time('Invoke Annotations$getMethodAnnotation(poke)');
$pokeName = $annotations->getMethodAnnotation('poke', Annotation_Name::NAME);
split_time('Invoke Annotations$getMethodAnnotation(poke)');
$annotations = Annotations::get(__CLASS__);
split_time('Invoke Annotations::get(' . __CLASS__ . ')');
$annotations = Annotations::get(__CLASS__);
split_time('Invoke Annotations::get(' . __CLASS__ . ')');
assertEquals('poke', $pokeName->value);
}
示例5: prepares_scope_configuration
/**
* @covers Mobileka\ScopeApplicator\Configurator::prepareScopes
* @test
*/
public function prepares_scope_configuration()
{
$configurator = $this->getInstance(null, ['scope', 'aliasedScope' => ['alias' => 'scopeAlias', 'keys' => ['firstKey', 'secondKey'], 'type' => 'int'], 'booleanScope' => ['type' => 'boolean']]);
$expect = ['scope' => ['alias' => 'scope'], 'aliasedScope' => ['alias' => 'scopeAlias', 'keys' => ['firstKey', 'secondKey'], 'type' => 'int'], 'booleanScope' => ['alias' => 'booleanScope', 'type' => 'boolean']];
$result = $configurator->prepareScopes();
assertEquals($expect, $result);
}
示例6: test_it_removes_instance
public function test_it_removes_instance()
{
$previous = $this->CollectionInstance->count();
$this->CollectionsManager->removeInstance(1);
$current = $this->CollectionInstance->count();
assertEquals($previous - 1, $current);
}
示例7: testName
public function testName()
{
$field = new StringField('hello');
assertEquals($field->name(), 'hello');
assertEquals($field->name('what'), $field);
assertEquals($field->name(), 'what');
}
示例8: test_it_updates_page_version
public function test_it_updates_page_version()
{
$event = $this->PageVersionSource->updatePageVersion(9999, '2015-01-01 00:00:00', '2015-01-01 23:59:59', $published = true);
assertEquals(9999, $event->id);
assertEquals('2015-01-01 00:00:00', $event->start);
assertEquals(true, $event->published);
}
示例9: testEmptyUrlGenerator
public function testEmptyUrlGenerator()
{
$configurations = ['default' => 'AwsS3', 'url' => 'https://s3.amazonaws.com', 'threshold' => 10, 'providers' => ['aws' => ['s3' => ['region' => 'us-standard', 'version' => 'latest', 'buckets' => ['' => '*'], 'acl' => 'public-read', 'cloudfront' => ['use' => false, 'cdn_url' => null], 'metadata' => [], 'expires' => gmdate('D, d M Y H:i:s T', strtotime('+5 years')), 'cache-control' => 'max-age=2628000', 'version' => null, 'http' => null]]]];
$this->p_awsS3Provider->init($configurations);
$result = $this->p_awsS3Provider->urlGenerator($this->path);
assertEquals($this->path_url, $result);
}
示例10: test_it_can_replace_live_span
public function test_it_can_replace_live_span()
{
$original = '@if(DeviseUser::checkRule(\'@livespan(#target-form-id,default value)\')) @endif <h3>\\@livespan(selector, value)</h3> @livespan(selector) @livespan() @livespan[selector, durka]';
$LiveSpan = new LiveSpan(new \Devise\Support\Str());
$replaced = $LiveSpan->replace($original);
assertEquals('@if(DeviseUser::checkRule(\'<span data-livespan="#target-form-id">default value</span>\')) @endif <h3>@livespan(selector, value)</h3> <span data-livespan="selector"></span> <span data-livespan=""></span> <span data-livespan="selector">durka</span>', $replaced);
}
示例11: test_it_cannot_store_permission
public function test_it_cannot_store_permission()
{
$input = $this->buildInput(['permission_name' => 'blah blah blah']);
$result = $this->PermissionsManager->storePermission($input);
assertInternalType('bool', $result);
assertEquals(false, $result);
}
示例12: test_it_can_execute_variable_store
public function test_it_can_execute_variable_store()
{
$this->TemplatesManager->shouldReceive('storeNewVariable')->andReturnSelf();
$this->Framework->Redirect->shouldReceive('route')->andReturnSelf()->shouldReceive('with')->andReturn('Variable successfully created');
$result = $this->TemplatesResponseHandler->executeVariableStore('foo.template.path', ['foo' => 'input']);
assertEquals('Variable successfully created', $result);
}
示例13: iShouldHaveAFieldAsTypeHasAWidgetRequiredAndAllowsValue
/**
* @Then /^I should have a "([^"]*)" field as a "([^"]*)" type, has a "([^"]*)" widget, (not required|required), and allows (\d+|(?i)unlimited) value[s]?[.]?$/
*/
public function iShouldHaveAFieldAsTypeHasAWidgetRequiredAndAllowsValue($name, $type, $widget, $required, $cardinality)
{
if (strcasecmp($cardinality, 'unlimited') == 0) {
$cardinality = '-1';
}
$fields = field_info_instances("node", $this->contentType->type);
$wantedField = NULL;
foreach ($fields as $field) {
if ($field['label'] == $name) {
$wantedField = $field;
}
}
assertNotEmpty($wantedField, "Field with the label {$name} doesn't exist");
$fieldInfo = field_info_field($wantedField['field_name']);
$widgetInfo = field_info_widget_types();
$fieldTypeInfo = field_info_field_types();
$wantedField['widget']['info'] = $widgetInfo[$wantedField['widget']['type']];
$wantedField['type'] = $fieldTypeInfo[$fieldInfo['type']];
assertEquals($type, $wantedField['type']['label'], "{$name} doesn't have the type {$type}. Instead it has " . $wantedField['type']['label'] . '.');
assertEquals($widget, $wantedField['widget']['info']['label'], "{$name} doesn't have the widget type {$widget}. Instead it has " . $wantedField['widget']['info']['label'] . '.');
$fieldRequired = $wantedField['required'] ? 'required' : 'not required';
assertEquals($required, $fieldRequired, "{$name} is marked '{$fieldRequired}'. It should be '{$required}'.");
assertEquals($cardinality, $fieldInfo['cardinality'], "{$name} allows " . $fieldInfo['cardinality'] . " values. It should only allow {$cardinality} values.");
$this->fieldList[] = $wantedField['field_name'];
}
示例14: testItMapsTheConfigArrayToInflectorDefinitions
public function testItMapsTheConfigArrayToInflectorDefinitions()
{
$interface = 'example_interface';
$methods = ['method1' => ['arg1', 'arg2']];
$subject = new InflectorConfig([$interface => $methods]);
assertEquals([new InflectorDefinition($interface, $methods)], iterator_to_array($subject));
}
示例15: testPushCommand
/**
* Integration Test.
*/
public function testPushCommand()
{
$configuration_file = ['bypass' => false, 'default' => 'AwsS3', 'url' => 'https://s3.amazonaws.com', 'threshold' => 10, 'providers' => ['aws' => ['s3' => ['region' => 'us-standard', 'version' => 'latest', 'buckets' => ['my-bucket-name' => '*'], 'acl' => 'public-read', 'cloudfront' => ['use' => false, 'cdn_url' => ''], 'metadata' => [], 'expires' => gmdate('D, d M Y H:i:s T', strtotime('+5 years')), 'cache-control' => 'max-age=2628000', 'version' => '']]], 'include' => ['directories' => [__DIR__], 'extensions' => [], 'patterns' => []], 'exclude' => ['directories' => [], 'files' => [], 'extensions' => [], 'patterns' => [], 'hidden' => true]];
$m_consol = M::mock('Symfony\\Component\\Console\\Output\\ConsoleOutput');
$m_consol->shouldReceive('writeln')->atLeast(1);
$finder = new \Vinelab\Cdn\Finder($m_consol);
$asset = new \Vinelab\Cdn\Asset();
$provider_factory = new \Vinelab\Cdn\ProviderFactory();
$m_config = M::mock('Illuminate\\Config\\Repository');
$m_config->shouldReceive('get')->with('cdn')->once()->andReturn($configuration_file);
$helper = new \Vinelab\Cdn\CdnHelper($m_config);
$m_console = M::mock('Symfony\\Component\\Console\\Output\\ConsoleOutput');
$m_console->shouldReceive('writeln')->atLeast(2);
$m_validator = M::mock('Vinelab\\Cdn\\Validators\\Contracts\\ProviderValidatorInterface');
$m_validator->shouldReceive('validate');
$m_helper = M::mock('Vinelab\\Cdn\\CdnHelper');
$m_spl_file = M::mock('Symfony\\Component\\Finder\\SplFileInfo');
$m_spl_file->shouldReceive('getPathname')->andReturn('vinelab/cdn/tests/Vinelab/Cdn/AwsS3ProviderTest.php');
$m_spl_file->shouldReceive('getRealPath')->andReturn(__DIR__ . '/AwsS3ProviderTest.php');
// partial mock
$p_aws_s3_provider = M::mock('\\Vinelab\\Cdn\\Providers\\AwsS3Provider[connect]', array($m_console, $m_validator, $m_helper));
$m_s3 = M::mock('Aws\\S3\\S3Client')->shouldIgnoreMissing();
$m_s3->shouldReceive('factory')->andReturn('Aws\\S3\\S3Client');
$m_command = M::mock('Aws\\Command');
$m_s3->shouldReceive('getCommand')->andReturn($m_command);
$m_s3->shouldReceive('execute');
$p_aws_s3_provider->setS3Client($m_s3);
$p_aws_s3_provider->shouldReceive('connect')->andReturn(true);
\Illuminate\Support\Facades\App::shouldReceive('make')->once()->andReturn($p_aws_s3_provider);
$cdn = new \Vinelab\Cdn\Cdn($finder, $asset, $provider_factory, $helper);
$result = $cdn->push();
assertEquals($result, true);
}