Commit b2112133 authored by catch's avatar catch

Issue #2887161 by Mohit Malik, joelpittet: Ensure argument order is correct...

Issue #2887161 by Mohit Malik, joelpittet: Ensure argument order is correct for assertSame() assertions
parent 38fca3a7
......@@ -45,10 +45,10 @@ public function testMigrationWithNonExistentLanguage() {
$count = 0;
foreach ($messages as $message) {
$count++;
$this->assertSame($message->message, "The language 'tv' does not exist on this site.");
$this->assertSame((int) $message->level, MigrationInterface::MESSAGE_ERROR);
$this->assertSame("The language 'tv' does not exist on this site.", $message->message);
$this->assertSame(MigrationInterface::MESSAGE_ERROR, (int) $message->level);
}
$this->assertSame($count, 1);
$this->assertSame(1, $count);
}
/**
......
......@@ -29,26 +29,26 @@ public function testLanguageNegotiationWithDefaultPathPrefix() {
]);
$config = $this->config('language.negotiation');
$this->assertSame($config->get('session.parameter'), 'language');
$this->assertSame($config->get('url.source'), LanguageNegotiationUrl::CONFIG_PATH_PREFIX);
$this->assertSame($config->get('selected_langcode'), 'site_default');
$this->assertSame('language', $config->get('session.parameter'));
$this->assertSame(LanguageNegotiationUrl::CONFIG_PATH_PREFIX, $config->get('url.source'));
$this->assertSame('site_default', $config->get('selected_langcode'));
$expected_prefixes = [
'en' => '',
'fr' => 'fr',
'zu' => 'zu',
];
$this->assertSame($config->get('url.prefixes'), $expected_prefixes);
$this->assertSame($expected_prefixes, $config->get('url.prefixes'));
$config = $this->config('language.types');
$this->assertSame($config->get('all'), ['language_interface', 'language_content', 'language_url']);
$this->assertSame($config->get('configurable'), ['language_interface']);
$this->assertSame($config->get('negotiation.language_content.enabled'), ['language-interface' => 0]);
$this->assertSame($config->get('negotiation.language_url.enabled'), ['language-url' => 0, 'language-url-fallback' => 1]);
$this->assertSame(['language_interface', 'language_content', 'language_url'], $config->get('all'));
$this->assertSame(['language_interface'], $config->get('configurable'));
$this->assertSame(['language-interface' => 0], $config->get('negotiation.language_content.enabled'));
$this->assertSame(['language-url' => 0, 'language-url-fallback' => 1], $config->get('negotiation.language_url.enabled'));
$expected_language_interface = [
'language-url' => 0,
'language-selected' => 1,
];
$this->assertSame($config->get('negotiation.language_interface.enabled'), $expected_language_interface);
$this->assertSame($expected_language_interface, $config->get('negotiation.language_interface.enabled'));
}
/**
......@@ -68,19 +68,19 @@ public function testLanguageNegotiationWithNoNegotiation() {
]);
$config = $this->config('language.negotiation');
$this->assertSame($config->get('session.parameter'), 'language');
$this->assertSame($config->get('url.source'), LanguageNegotiationUrl::CONFIG_PATH_PREFIX);
$this->assertSame($config->get('selected_langcode'), 'site_default');
$this->assertSame('language', $config->get('session.parameter'));
$this->assertSame(LanguageNegotiationUrl::CONFIG_PATH_PREFIX, $config->get('url.source'));
$this->assertSame('site_default', $config->get('selected_langcode'));
$config = $this->config('language.types');
$this->assertSame($config->get('all'), ['language_interface', 'language_content', 'language_url']);
$this->assertSame($config->get('configurable'), ['language_interface']);
$this->assertSame($config->get('negotiation.language_content.enabled'), ['language-interface' => 0]);
$this->assertSame($config->get('negotiation.language_url.enabled'), ['language-url' => 0, 'language-url-fallback' => 1]);
$this->assertSame(['language_interface', 'language_content', 'language_url'], $config->get('all'));
$this->assertSame(['language_interface'], $config->get('configurable'));
$this->assertSame(['language-interface' => 0], $config->get('negotiation.language_content.enabled'));
$this->assertSame(['language-url' => 0, 'language-url-fallback' => 1], $config->get('negotiation.language_url.enabled'));
$expected_language_interface = [
'language-selected' => 0,
];
$this->assertSame($config->get('negotiation.language_interface.enabled'), $expected_language_interface);
$this->assertSame($expected_language_interface, $config->get('negotiation.language_interface.enabled'));
}
/**
......@@ -100,28 +100,28 @@ public function testLanguageNegotiationWithPathPrefix() {
]);
$config = $this->config('language.negotiation');
$this->assertSame($config->get('session.parameter'), 'language');
$this->assertSame($config->get('url.source'), LanguageNegotiationUrl::CONFIG_PATH_PREFIX);
$this->assertSame($config->get('selected_langcode'), 'site_default');
$this->assertSame('language', $config->get('session.parameter'));
$this->assertSame(LanguageNegotiationUrl::CONFIG_PATH_PREFIX, $config->get('url.source'));
$this->assertSame('site_default', $config->get('selected_langcode'));
$expected_prefixes = [
'en' => '',
'fr' => 'fr',
'zu' => 'zu',
];
$this->assertSame($config->get('url.prefixes'), $expected_prefixes);
$this->assertSame($expected_prefixes, $config->get('url.prefixes'));
$config = $this->config('language.types');
$this->assertSame($config->get('all'), ['language_interface', 'language_content', 'language_url']);
$this->assertSame($config->get('configurable'), ['language_interface']);
$this->assertSame($config->get('negotiation.language_content.enabled'), ['language-interface' => 0]);
$this->assertSame($config->get('negotiation.language_url.enabled'), ['language-url' => 0, 'language-url-fallback' => 1]);
$this->assertSame(['language_interface', 'language_content', 'language_url'], $config->get('all'));
$this->assertSame(['language_interface'], $config->get('configurable'));
$this->assertSame(['language-interface' => 0], $config->get('negotiation.language_content.enabled'));
$this->assertSame(['language-url' => 0, 'language-url-fallback' => 1], $config->get('negotiation.language_url.enabled'));
$expected_language_interface = [
'language-url' => 0,
'language-user' => 1,
'language-browser' => 2,
'language-selected' => 3,
];
$this->assertSame($config->get('negotiation.language_interface.enabled'), $expected_language_interface);
$this->assertSame($expected_language_interface, $config->get('negotiation.language_interface.enabled'));
}
/**
......@@ -142,26 +142,26 @@ public function testLanguageNegotiationWithDomain() {
global $base_url;
$config = $this->config('language.negotiation');
$this->assertSame($config->get('session.parameter'), 'language');
$this->assertSame($config->get('url.source'), LanguageNegotiationUrl::CONFIG_DOMAIN);
$this->assertSame($config->get('selected_langcode'), 'site_default');
$this->assertSame('language', $config->get('session.parameter'));
$this->assertSame(LanguageNegotiationUrl::CONFIG_DOMAIN, $config->get('url.source'));
$this->assertSame('site_default', $config->get('selected_langcode'));
$expected_domains = [
'en' => parse_url($base_url, PHP_URL_HOST),
'fr' => 'fr.drupal.org',
'zu' => 'zu.drupal.org',
];
$this->assertSame($config->get('url.domains'), $expected_domains);
$this->assertSame($expected_domains, $config->get('url.domains'));
$config = $this->config('language.types');
$this->assertSame($config->get('all'), ['language_interface', 'language_content', 'language_url']);
$this->assertSame($config->get('configurable'), ['language_interface']);
$this->assertSame($config->get('negotiation.language_content.enabled'), ['language-interface' => 0]);
$this->assertSame($config->get('negotiation.language_url.enabled'), ['language-url' => 0, 'language-url-fallback' => 1]);
$this->assertSame(['language_interface', 'language_content', 'language_url'], $config->get('all'));
$this->assertSame(['language_interface'], $config->get('configurable'));
$this->assertSame(['language-interface' => 0], $config->get('negotiation.language_content.enabled'));
$this->assertSame(['language-url' => 0, 'language-url-fallback' => 1], $config->get('negotiation.language_url.enabled'));
$expected_language_interface = [
'language-url' => 0,
'language-selected' => 1,
];
$this->assertSame($config->get('negotiation.language_interface.enabled'), $expected_language_interface);
$this->assertSame($expected_language_interface, $config->get('negotiation.language_interface.enabled'));
}
}
......@@ -45,10 +45,10 @@ public function testMigrationWithNonExistentLanguage() {
$count = 0;
foreach ($messages as $message) {
$count++;
$this->assertSame($message->message, "The language 'tv' does not exist on this site.");
$this->assertSame((int) $message->level, MigrationInterface::MESSAGE_ERROR);
$this->assertSame("The language 'tv' does not exist on this site.", $message->message);
$this->assertSame(MigrationInterface::MESSAGE_ERROR, (int) $message->level);
}
$this->assertSame($count, 1);
$this->assertSame(1, $count);
}
/**
......
......@@ -28,10 +28,10 @@ public function testLanguageTypes() {
]);
$config = $this->config('language.types');
$this->assertSame($config->get('all'), ['language_content', 'language_url', 'language_interface']);
$this->assertSame($config->get('configurable'), ['language_interface']);
$this->assertSame($config->get('negotiation.language_content'), ['enabled' => ['language-interface' => 0]]);
$this->assertSame($config->get('negotiation.language_url'), ['enabled' => ['language-url' => 0, 'language-url-fallback' => 1]]);
$this->assertSame(['language_content', 'language_url', 'language_interface'], $config->get('all'));
$this->assertSame(['language_interface'], $config->get('configurable'));
$this->assertSame(['enabled' => ['language-interface' => 0]], $config->get('negotiation.language_content'));
$this->assertSame(['enabled' => ['language-url' => 0, 'language-url-fallback' => 1]], $config->get('negotiation.language_url'));
$expected_language_interface = [
'enabled' => [
'language-url' => -9,
......@@ -46,7 +46,7 @@ public function testLanguageTypes() {
'language-selected' => -6,
],
];
$this->assertSame($config->get('negotiation.language_interface'), $expected_language_interface);
$this->assertSame($expected_language_interface, $config->get('negotiation.language_interface'));
}
/**
......@@ -60,14 +60,14 @@ public function testLanguageNegotiationWithPrefix() {
]);
$config = $this->config('language.negotiation');
$this->assertSame($config->get('session.parameter'), 'language');
$this->assertSame($config->get('url.source'), LanguageNegotiationUrl::CONFIG_PATH_PREFIX);
$this->assertSame($config->get('selected_langcode'), 'site_default');
$this->assertSame('language', $config->get('session.parameter'));
$this->assertSame(LanguageNegotiationUrl::CONFIG_PATH_PREFIX, $config->get('url.source'));
$this->assertSame('site_default', $config->get('selected_langcode'));
$expected_prefixes = [
'en' => '',
'is' => 'is',
];
$this->assertSame($config->get('url.prefixes'), $expected_prefixes);
$this->assertSame($expected_prefixes, $config->get('url.prefixes'));
}
/**
......@@ -87,14 +87,14 @@ public function testLanguageNegotiationWithDomain() {
global $base_url;
$config = $this->config('language.negotiation');
$this->assertSame($config->get('session.parameter'), 'language');
$this->assertSame($config->get('url.source'), LanguageNegotiationUrl::CONFIG_DOMAIN);
$this->assertSame($config->get('selected_langcode'), 'site_default');
$this->assertSame('language', $config->get('session.parameter'));
$this->assertSame(LanguageNegotiationUrl::CONFIG_DOMAIN, $config->get('url.source'));
$this->assertSame('site_default', $config->get('selected_langcode'));
$expected_domains = [
'en' => parse_url($base_url, PHP_URL_HOST),
'is' => 'is.drupal.org',
];
$this->assertSame($config->get('url.domains'), $expected_domains);
$this->assertSame($expected_domains, $config->get('url.domains'));
}
/**
......@@ -112,14 +112,14 @@ public function testLanguageNegotiationWithNonExistentVariables() {
]);
$config = $this->config('language.negotiation');
$this->assertSame($config->get('session.parameter'), 'language');
$this->assertSame($config->get('url.source'), LanguageNegotiationUrl::CONFIG_PATH_PREFIX);
$this->assertSame($config->get('selected_langcode'), 'site_default');
$this->assertSame('language', $config->get('session.parameter'));
$this->assertSame(LanguageNegotiationUrl::CONFIG_PATH_PREFIX, $config->get('url.source'));
$this->assertSame('site_default', $config->get('selected_langcode'));
$expected_prefixes = [
'en' => '',
'is' => 'is',
];
$this->assertSame($config->get('url.prefixes'), $expected_prefixes);
$this->assertSame($expected_prefixes, $config->get('url.prefixes'));
}
}
......@@ -47,8 +47,8 @@ public function testConnectionTypes() {
// Verify that falling back to the default 'migrate' connection (defined in
// the base class) works.
$this->assertSame($sql_base->getDatabase()->getTarget(), 'default');
$this->assertSame($sql_base->getDatabase()->getKey(), 'migrate');
$this->assertSame('default', $sql_base->getDatabase()->getTarget());
$this->assertSame('migrate', $sql_base->getDatabase()->getKey());
// Verify the fallback state key overrides the 'migrate' connection.
$target = 'test_fallback_target';
......
......@@ -44,8 +44,8 @@ public function testImport() {
->method('save')
->with();
$plugin = new TestPerComponentEntityDisplay($entity);
$this->assertSame($plugin->import($row), ['entity_type_test', 'bundle_test', 'view_mode_test', 'field_name_test']);
$this->assertSame($plugin->getTestValues(), ['entity_type_test', 'bundle_test', 'view_mode_test']);
$this->assertSame(['entity_type_test', 'bundle_test', 'view_mode_test', 'field_name_test'], $plugin->import($row));
$this->assertSame(['entity_type_test', 'bundle_test', 'view_mode_test'], $plugin->getTestValues());
}
}
......
......@@ -44,8 +44,8 @@ public function testImport() {
->method('save')
->with();
$plugin = new TestPerComponentEntityFormDisplay($entity);
$this->assertSame($plugin->import($row), ['entity_type_test', 'bundle_test', 'form_mode_test', 'field_name_test']);
$this->assertSame($plugin->getTestValues(), ['entity_type_test', 'bundle_test', 'form_mode_test']);
$this->assertSame(['entity_type_test', 'bundle_test', 'form_mode_test', 'field_name_test'], $plugin->import($row));
$this->assertSame(['entity_type_test', 'bundle_test', 'form_mode_test'], $plugin->getTestValues());
}
}
......
......@@ -30,7 +30,7 @@ protected function setUp() {
public function testCallbackWithFunction() {
$this->plugin->setCallable('strtolower');
$value = $this->plugin->transform('FooBar', $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'foobar');
$this->assertSame('foobar', $value);
}
/**
......@@ -39,7 +39,7 @@ public function testCallbackWithFunction() {
public function testCallbackWithClassMethod() {
$this->plugin->setCallable(['\Drupal\Component\Utility\Unicode', 'strtolower']);
$value = $this->plugin->transform('FooBar', $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'foobar');
$this->assertSame('foobar', $value);
}
}
......
......@@ -30,7 +30,7 @@ protected function setUp() {
*/
public function testConcatWithoutDelimiter() {
$value = $this->plugin->transform(['foo', 'bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'foobar');
$this->assertSame('foobar', $value);
}
/**
......@@ -47,7 +47,7 @@ public function testConcatWithNonArray() {
public function testConcatWithDelimiter() {
$this->plugin->setDelimiter('_');
$value = $this->plugin->transform(['foo', 'bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'foo_bar');
$this->assertSame('foo_bar', $value);
}
}
......
......@@ -29,7 +29,7 @@ protected function setUp() {
*/
public function testTransform() {
$value = $this->plugin->transform('foo,bar,tik', $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, ['foo', 'bar', 'tik']);
$this->assertSame(['foo', 'bar', 'tik'], $value);
}
/**
......@@ -38,7 +38,7 @@ public function testTransform() {
public function testTransformLimit() {
$plugin = new Explode(['delimiter' => '_', 'limit' => 2], 'map', []);
$value = $plugin->transform('foo_bar_tik', $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, ['foo', 'bar_tik']);
$this->assertSame(['foo', 'bar_tik'], $value);
}
/**
......@@ -49,7 +49,7 @@ public function testChainedTransform() {
$concat = new Concat([], 'map', []);
$concatenated = $concat->transform($exploded, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($concatenated, 'foobartik');
$this->assertSame('foobartik', $concatenated);
}
/**
......
......@@ -25,7 +25,7 @@ protected function setUp() {
*/
public function testExtract() {
$value = $this->plugin->transform(['foo' => 'bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'bar');
$this->assertSame('bar', $value);
}
/**
......@@ -50,7 +50,7 @@ public function testExtractFail() {
public function testExtractFailDefault() {
$plugin = new Extract(['index' => ['foo'], 'default' => 'test'], 'map', []);
$value = $plugin->transform(['bar' => 'foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'test', '');
$this->assertSame('test', $value, '');
}
}
......@@ -17,7 +17,7 @@ class FlattenTest extends MigrateProcessTestCase {
public function testFlatten() {
$plugin = new Flatten([], 'flatten', []);
$flattened = $plugin->transform([1, 2, [3, 4, [5]], [], [7, 8]], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($flattened, [1, 2, 3, 4, 5, 7, 8]);
$this->assertSame([1, 2, 3, 4, 5, 7, 8], $flattened);
}
}
......@@ -34,7 +34,7 @@ public function testTransformSourceString() {
->will($this->returnValue('source_value'));
$this->plugin->setSource('test');
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'source_value');
$this->assertSame('source_value', $value);
}
/**
......@@ -52,7 +52,7 @@ public function testTransformSourceArray() {
return $map[$argument];
}));
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, ['source_value1', 'source_value2']);
$this->assertSame(['source_value1', 'source_value2'], $value);
}
/**
......@@ -65,7 +65,7 @@ public function testTransformSourceStringAt() {
->will($this->returnValue('source_value'));
$this->plugin->setSource('@@test');
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'source_value');
$this->assertSame('source_value', $value);
}
/**
......@@ -85,7 +85,7 @@ public function testTransformSourceArrayAt() {
return $map[$argument];
}));
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, ['source_value1', 'source_value2', 'source_value3', 'source_value4']);
$this->assertSame(['source_value1', 'source_value2', 'source_value3', 'source_value4'], $value);
}
/**
......
......@@ -75,10 +75,10 @@ public function testIterator() {
// values ended up in the proper destinations, and that the value of the
// key (@id) is the same as the destination ID (42).
$new_value = $plugin->transform($current_value, $migrate_executable, $row, 'test');
$this->assertSame(count($new_value), 1);
$this->assertSame(count($new_value[42]), 2);
$this->assertSame($new_value[42]['foo'], 'test');
$this->assertSame($new_value[42]['id'], 42);
$this->assertSame(1, count($new_value));
$this->assertSame(2, count($new_value[42]));
$this->assertSame('test', $new_value[42]['foo']);
$this->assertSame(42, $new_value[42]['id']);
}
}
......@@ -31,7 +31,7 @@ public function testProcessBypassesOnNonEmpty() {
$configuration['method'] = 'process';
$value = (new SkipOnEmpty($configuration, 'skip_on_empty', []))
->transform(' ', $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, ' ');
$this->assertSame(' ', $value);
}
/**
......@@ -51,7 +51,7 @@ public function testRowBypassesOnNonEmpty() {
$configuration['method'] = 'row';
$value = (new SkipOnEmpty($configuration, 'skip_on_empty', []))
->transform(' ', $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, ' ');
$this->assertSame(' ', $value);
}
/**
......
......@@ -27,7 +27,7 @@ protected function setUp() {
*/
public function testMapWithSourceString() {
$value = $this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, ['bar' => 'baz']);
$this->assertSame(['bar' => 'baz'], $value);
}
/**
......@@ -35,7 +35,7 @@ public function testMapWithSourceString() {
*/
public function testMapWithSourceList() {
$value = $this->plugin->transform(['foo', 'bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'baz');
$this->assertSame('baz', $value);
}
/**
......@@ -62,7 +62,7 @@ public function testMapWithInvalidSourceWithADefaultValue() {
$configuration['default_value'] = 'test';
$this->plugin = new StaticMap($configuration, 'map', []);
$value = $this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'test');
$this->assertSame('test', $value);
}
/**
......
......@@ -73,10 +73,10 @@ public function testSubProcess() {
// values ended up in the proper destinations, and that the value of the
// key (@id) is the same as the destination ID (42).
$new_value = $plugin->transform($current_value, $migrate_executable, $row, 'test');
$this->assertSame(count($new_value), 1);
$this->assertSame(count($new_value[42]), 2);
$this->assertSame($new_value[42]['foo'], 'test');
$this->assertSame($new_value[42]['id'], 42);
$this->assertSame(1, count($new_value));
$this->assertSame(2, count($new_value[42]));
$this->assertSame('test', $new_value[42]['foo']);
$this->assertSame(42, $new_value[42]['id']);
}
}
......@@ -65,23 +65,23 @@ public function testTaxonomyUpdateParents() {
$term = Term::load(3);
$this->assertCount(1, $term->parent);
// Target ID is returned as string.
$this->assertSame((int) $term->get('parent')[0]->target_id, 0);
$this->assertSame(0, (int) $term->get('parent')[0]->target_id);
// Test if the view has been converted to use the {taxonomy_term__parent}
// table instead of the {taxonomy_term_hierarchy} table.
$view = $this->config("views.view.test_taxonomy_parent");
$relationship_base_path = 'display.default.display_options.relationships.parent';
$this->assertSame($view->get("$relationship_base_path.table"), 'taxonomy_term__parent');
$this->assertSame($view->get("$relationship_base_path.field"), 'parent_target_id');
$this->assertSame('taxonomy_term__parent', $view->get("$relationship_base_path.table"));
$this->assertSame('parent_target_id', $view->get("$relationship_base_path.field"));
$filters_base_path_1 = 'display.default.display_options.filters.parent';
$this->assertSame($view->get("$filters_base_path_1.table"), 'taxonomy_term__parent');
$this->assertSame($view->get("$filters_base_path_1.field"), 'parent_target_id');
$this->assertSame('taxonomy_term__parent', $view->get("$filters_base_path_1.table"));
$this->assertSame('parent_target_id', $view->get("$filters_base_path_1.field"));
$filters_base_path_2 = 'display.default.display_options.filters.parent';
$this->assertSame($view->get("$filters_base_path_2.table"), 'taxonomy_term__parent');
$this->assertSame($view->get("$filters_base_path_2.field"), 'parent_target_id');
$this->assertSame('taxonomy_term__parent', $view->get("$filters_base_path_2.table"));
$this->assertSame('parent_target_id', $view->get("$filters_base_path_2.field"));
// The {taxonomy_term_hierarchy} table has been removed.
$this->assertFalse($this->db->schema()->tableExists('taxonomy_term_hierarchy'));
......
......@@ -125,7 +125,7 @@ public function testReadWriteConfig() {
$this->assertIdentical($config->get('null'), NULL);
// Read false that had been nested in an array value.
$this->assertSame($config->get($casting_array_false_value_key), FALSE, "Nested boolean FALSE value returned FALSE.");
$this->assertSame(FALSE, $config->get($casting_array_false_value_key), "Nested boolean FALSE value returned FALSE.");
// Unset a top level value.
$config->clear($key);
......
......@@ -63,7 +63,7 @@ public function testGetUrlIfValidWithoutAccessCheck() {
$url = $pathValidator->getUrlIfValidWithoutAccessCheck($entity->toUrl()->toString(TRUE)->getGeneratedUrl());
$this->assertEquals($method, $requestContext->getMethod());
$this->assertInstanceOf(Url::class, $url);
$this->assertSame($url->getRouteParameters(), ['entity_test' => $entity->id()]);
$this->assertSame(['entity_test' => $entity->id()], $url->getRouteParameters());
}
}
......
......@@ -63,14 +63,14 @@ public function testReadOnly() {
// Write out a PHP file and ensure it's successfully loaded.
$code = "<?php\n\$GLOBALS[$random] = TRUE;";
$success = $php->save($name, $code);
$this->assertSame($success, TRUE);
$this->assertSame(TRUE, $success);
$php_read = new FileReadOnlyStorage($this->readonlyStorage);
$php_read->load($name);
$this->assertTrue($GLOBALS[$random]);
// If the file was successfully loaded, it must also exist, but ensure the
// exists() method returns that correctly.
$this->assertSame($php_read->exists($name), TRUE);
$this->assertSame(TRUE, $php_read->exists($name));
// Saving and deleting should always fail.
$this->assertFalse($php_read->save($name, $code));
$this->assertFalse($php_read->delete($name));
......
......@@ -89,8 +89,8 @@ public function testSecurity() {
// minimal permissions. fileperms() can return high bits unrelated to
// permissions, so mask with 0777.
$this->assertTrue(file_exists($expected_filename));
$this->assertSame(fileperms($expected_filename) & 0777, 0444);
$this->assertSame(fileperms($expected_directory) & 0777, 0777);
$this->assertSame(0444, fileperms($expected_filename) & 0777);
$this->assertSame(0777, fileperms($expected_directory) & 0777);
// Ensure the root directory for the bin has a .htaccess file denying web
// access.
......@@ -121,9 +121,9 @@ public function testSecurity() {
chmod($expected_filename, 0400);
chmod($expected_directory, 0100);
$this->assertSame(file_get_contents($expected_filename), $untrusted_code);
$this->assertSame($php->exists($name), $this->expected[$i]);
$this->assertSame($php->load($name), $this->expected[$i]);
$this->assertSame($GLOBALS['hacked'], $this->expected[$i]);
$this->assertSame($this->expected[$i], $php->exists($name));
$this->assertSame($this->expected[$i], $php->load($name));
$this->assertSame($this->expected[$i], $GLOBALS['hacked']);
}
unset($GLOBALS['hacked']);
}
......
......@@ -58,7 +58,7 @@ protected function setUp() {
*/
public function testEncodingAscii() {
// Verify there aren't character encoding problems with the source string.
$this->assertSame(strlen($this->string), 127, 'A string with the full ASCII table has the correct length.');
$this->assertSame(127, strlen($this->string), 'A string with the full ASCII table has the correct length.');
foreach ($this->htmlUnsafe as $char) {
$this->assertTrue(strpos($this->string, $char) > 0, sprintf('A string with the full ASCII table includes %s.', $char));
}
......
......@@ -182,7 +182,7 @@ public function testSafeInclude() {
]);
$transliteration = new PhpTransliteration(vfsStream::url('transliteration/dir'));
$transliterated = $transliteration->transliterate(chr(0xC2) . chr(0x82), '../index');
$this->assertSame($transliterated, 'safe');
$this->assertSame('safe', $transliterated);
}
}
......@@ -52,9 +52,9 @@ public function testCommands() {
// Ensure that the added commands are in the right order.
$commands =& $this->ajaxResponse->getCommands();
$this->assertSame($commands[1], ['command' => 'one']);
$this->assertSame($commands[2], ['command' => 'two']);
$this->assertSame($commands[0], ['command' => 'three']);