Commit 09be91a3 authored by catch's avatar catch
Browse files

Issue #3126564 by longwave, mondrake: Replace usage of assertArraySubset(), that is deprecated

parent 7e04d241
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public function testCommentPublishUnpublishActions() {
    $action = Action::load('comment_unpublish_action');
    $action->execute([$comment]);
    $this->assertTrue($comment->isPublished() === FALSE, 'Comment was unpublished');
    $this->assertArraySubset(['module' => ['comment']], $action->getDependencies());
    $this->assertSame(['module' => ['comment']], $action->getDependencies());
    // Publish a comment.
    $action = Action::load('comment_publish_action');
    $action->execute([$comment]);
+3 −1
Original line number Diff line number Diff line
@@ -54,7 +54,9 @@ public function testMigration() {
      'comment_preview' => 'Preview comment',
      'comment_form_location' => 'Location of comment submission form',
    ];
    $this->assertArraySubset($comment_fields, $this->migration->getSourcePlugin()->fields());
    foreach ($comment_fields as $field => $description) {
      $this->assertEquals($description, $this->migration->getSourcePlugin()->fields()[$field]);
    }

    $this->assertEntity('comment_node_article', 'Article comment');
    $this->assertEntity('comment_node_blog', 'Blog entry comment');
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ public function testDisplayErrorMessagesNotInline() {

    // Just test if the #error_no_message property is TRUE. FormErrorHandlerTest
    // tests if the property actually hides the error message.
    $this->assertArraySubset(['#error_no_message' => TRUE], $form['test']);
    $this->assertTrue($form['test']['#error_no_message']);
  }

}
+6 −2
Original line number Diff line number Diff line
@@ -2005,7 +2005,9 @@ public function testPostIndividual() {
        // properties are present, the server could be computing additional
        // properties.
        if (is_array($field_normalization)) {
          $this->assertArraySubset($field_normalization, $created_entity_document['data']['attributes'][$field_name]);
          foreach ($field_normalization as $value) {
            $this->assertContains($value, $created_entity_document['data']['attributes'][$field_name]);
          }
        }
        else {
          $this->assertSame($field_normalization, $created_entity_document['data']['attributes'][$field_name]);
@@ -2259,7 +2261,9 @@ public function testPatchIndividual() {
      // properties are present, the server could be computing additional
      // properties.
      if (is_array($field_normalization)) {
        $this->assertArraySubset($field_normalization, $updated_entity_document['data']['attributes'][$field_name]);
        foreach ($field_normalization as $value) {
          $this->assertContains($value, $updated_entity_document['data']['attributes'][$field_name]);
        }
      }
      else {
        $this->assertSame($field_normalization, $updated_entity_document['data']['attributes'][$field_name]);
+8 −4
Original line number Diff line number Diff line
@@ -288,7 +288,7 @@ public function testNormalize() {
    $this->assertTrue(!isset($normalized['included'][1]['attributes']['created']));
    // Make sure that the cache tags for the includes and the requested entities
    // are bubbling as expected.
    $this->assertArraySubset(
    $this->assertSame(
      ['file:1', 'node:1', 'taxonomy_term:1', 'taxonomy_term:2', 'user:1'],
      $jsonapi_doc_object->getCacheTags()
    );
@@ -378,7 +378,7 @@ public function testNormalizeUuid() {
    $this->assertCount(12, $normalized['included'][1]['attributes']);
    // Make sure that the cache tags for the includes and the requested entities
    // are bubbling as expected.
    $this->assertArraySubset(
    $this->assertSame(
      ['node:1', 'taxonomy_term:1', 'taxonomy_term:2', 'user:1'],
      $jsonapi_doc_object->getCacheTags()
    );
@@ -693,8 +693,12 @@ public function testCacheableMetadata(CacheableMetadata $expected_metadata, $fie
      'account' => NULL,
    ];
    $jsonapi_doc_object = $this->getNormalizer()->normalize(new JsonApiDocumentTopLevel(new ResourceObjectData([$resource_object], 1), new NullIncludedData(), new LinkCollection([])), 'api_json', $context);
    $this->assertArraySubset($expected_metadata->getCacheTags(), $jsonapi_doc_object->getCacheTags());
    $this->assertArraySubset($expected_metadata->getCacheContexts(), $jsonapi_doc_object->getCacheContexts());
    foreach ($expected_metadata->getCacheTags() as $tag) {
      $this->assertContains($tag, $jsonapi_doc_object->getCacheTags());
    }
    foreach ($expected_metadata->getCacheContexts() as $context) {
      $this->assertContains($context, $jsonapi_doc_object->getCacheContexts());
    }
    $this->assertSame($expected_metadata->getCacheMaxAge(), $jsonapi_doc_object->getCacheMaxAge());
  }

Loading