Commit 4afd6fb8 authored by catch's avatar catch
Browse files

Issue #3131223 by jungle, mondrake, longwave: Replace assertions involving...

Issue #3131223 by jungle, mondrake, longwave: Replace assertions involving calls to array_key_exists() with assertArrayHasKey()/assertArrayNotHasKey()
parent 09541929
Loading
Loading
Loading
Loading
+1 −1
Changes for core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ public function testFormatterUI() {
    /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */
    $display = $display_storage->loadUnchanged($display_id);
    $component = $display->getComponent('field_test');
    $this->assertFalse(array_key_exists('field_third_party_test', $component['third_party_settings']));
    $this->assertArrayNotHasKey('field_third_party_test', $component['third_party_settings']);
  }

  /**
+1 −1
Changes for core/modules/image/tests/src/Functional/ImageAdminStylesTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ public function testNumericStyleName() {
    $this->drupalPostForm('admin/config/media/image-styles/add', $edit, t('Create new style'));
    $this->assertRaw(t('Style %name was created.', ['%name' => $style_label]));
    $options = image_style_options();
    $this->assertTrue(array_key_exists($style_name, $options), new FormattableMarkup('Array key %key exists.', ['%key' => $style_name]));
    $this->assertArrayHasKey($style_name, $options);
  }

  /**
+2 −2
Changes for core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -552,8 +552,8 @@ public function testContentCustomization() {
    $this->assertTrue(in_array('language_content', $config->get('configurable')), 'Content language is configurable.');

    // Ensure configuration was saved.
    $this->assertFalse(array_key_exists('language-url', $config->get('negotiation.language_content.enabled')), 'URL negotiation is not enabled for content.');
    $this->assertTrue(array_key_exists('language-session', $config->get('negotiation.language_content.enabled')), 'Session negotiation is enabled for content.');
    $this->assertArrayNotHasKey('language-url', $config->get('negotiation.language_content.enabled'));
    $this->assertArrayHasKey('language-session', $config->get('negotiation.language_content.enabled'));
  }

  /**
+10 −10
Changes for core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php: 10 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -263,10 +263,10 @@ public function testNodeAccessLanguageAwareCombination() {
    // Four nodes should be returned with public Hungarian translations or the
    // no language public node.
    $this->assertEqual(count($nids), 4, 'Query returns 4 nodes when no langcode is specified.');
    $this->assertTrue(array_key_exists($this->nodes['public_both_public']->id(), $nids), 'Returned node ID is full public node.');
    $this->assertTrue(array_key_exists($this->nodes['public_ca_private']->id(), $nids), 'Returned node ID is Hungarian public only node.');
    $this->assertTrue(array_key_exists($this->nodes['private_both_public']->id(), $nids), 'Returned node ID is both public non-language-aware private only node.');
    $this->assertTrue(array_key_exists($this->nodes['public_no_language_public']->id(), $nids), 'Returned node ID is no language public node.');
    $this->assertArrayHasKey($this->nodes['public_both_public']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['public_ca_private']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['private_both_public']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['public_no_language_public']->id(), $nids);

    // Query with Hungarian (hu) specified.
    $select = $connection->select('node', 'n')
@@ -278,9 +278,9 @@ public function testNodeAccessLanguageAwareCombination() {

    // Three nodes should be returned (with public Hungarian translations).
    $this->assertEqual(count($nids), 3, 'Query returns 3 nodes.');
    $this->assertTrue(array_key_exists($this->nodes['public_both_public']->id(), $nids), 'Returned node ID is both public node.');
    $this->assertTrue(array_key_exists($this->nodes['public_ca_private']->id(), $nids), 'Returned node ID is Hungarian public only node.');
    $this->assertTrue(array_key_exists($this->nodes['private_both_public']->id(), $nids), 'Returned node ID is both public non-language-aware private only node.');
    $this->assertArrayHasKey($this->nodes['public_both_public']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['public_ca_private']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['private_both_public']->id(), $nids);

    // Query with Catalan (ca) specified.
    $select = $connection->select('node', 'n')
@@ -292,9 +292,9 @@ public function testNodeAccessLanguageAwareCombination() {

    // Three nodes should be returned (with public Catalan translations).
    $this->assertEqual(count($nids), 3, 'Query returns 3 nodes.');
    $this->assertTrue(array_key_exists($this->nodes['public_both_public']->id(), $nids), 'Returned node ID is both public node.');
    $this->assertTrue(array_key_exists($this->nodes['public_hu_private']->id(), $nids), 'Returned node ID is Catalan public only node.');
    $this->assertTrue(array_key_exists($this->nodes['private_both_public']->id(), $nids), 'Returned node ID is both public non-language-aware private only node.');
    $this->assertArrayHasKey($this->nodes['public_both_public']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['public_hu_private']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['private_both_public']->id(), $nids);

    // Query with German (de) specified.
    $select = $connection->select('node', 'n')
+7 −7
Changes for core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php: 7 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -206,9 +206,9 @@ public function testNodeAccessLanguageAware() {
    // - Node with only the Catalan translation marked as private.
    // - No language node marked as public.
    $this->assertEqual(count($nids), 3, 'db_select() returns 3 nodes when no langcode is specified.');
    $this->assertTrue(array_key_exists($this->nodes['both_public']->id(), $nids), 'The node with both translations public is returned.');
    $this->assertTrue(array_key_exists($this->nodes['ca_private']->id(), $nids), 'The node with only the Catalan translation private is returned.');
    $this->assertTrue(array_key_exists($this->nodes['no_language_public']->id(), $nids), 'The node with no language is returned.');
    $this->assertArrayHasKey($this->nodes['both_public']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['ca_private']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['no_language_public']->id(), $nids);

    // Query with Hungarian (hu) specified.
    $select = $connection->select('node', 'n')
@@ -221,8 +221,8 @@ public function testNodeAccessLanguageAware() {
    // Two nodes should be returned: the node with both translations public, and
    // the node with only the Catalan translation marked as private.
    $this->assertEqual(count($nids), 2, 'Query returns 2 nodes when the hu langcode is specified.');
    $this->assertTrue(array_key_exists($this->nodes['both_public']->id(), $nids), 'The node with both translations public is returned.');
    $this->assertTrue(array_key_exists($this->nodes['ca_private']->id(), $nids), 'The node with only the Catalan translation private is returned.');
    $this->assertArrayHasKey($this->nodes['both_public']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['ca_private']->id(), $nids);

    // Query with Catalan (ca) specified.
    $select = $connection->select('node', 'n')
@@ -235,8 +235,8 @@ public function testNodeAccessLanguageAware() {
    // Two nodes should be returned: the node with both translations public, and
    // the node with only the Hungarian translation marked as private.
    $this->assertEqual(count($nids), 2, 'Query returns 2 nodes when the hu langcode is specified.');
    $this->assertTrue(array_key_exists($this->nodes['both_public']->id(), $nids), 'The node with both translations public is returned.');
    $this->assertTrue(array_key_exists($this->nodes['hu_private']->id(), $nids), 'The node with only the Hungarian translation private is returned.');
    $this->assertArrayHasKey($this->nodes['both_public']->id(), $nids);
    $this->assertArrayHasKey($this->nodes['hu_private']->id(), $nids);

    // Query with German (de) specified.
    $select = $connection->select('node', 'n')
Loading