Commit 336c3ef2 authored by catch's avatar catch
Browse files

Issue #3351060 by Spokje: Fix PHPStan L1 errors "You should use assertNull()...

Issue #3351060 by Spokje: Fix PHPStan L1 errors "You should use assertNull() instead of assertSame(null, $actual)."
parent 850d4b89
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ public function testMigration() {
    $this->assertSame('The first comment.', $comment->getSubject());
    $this->assertSame('The first comment body.', $comment->comment_body->value);
    $this->assertSame('filtered_html', $comment->comment_body->format);
    $this->assertSame(NULL, $comment->pid->target_id);
    $this->assertNull($comment->pid->target_id);
    $this->assertSame('1', $comment->getCommentedEntityId());
    $this->assertSame('node', $comment->getCommentedEntityTypeId());
    $this->assertSame('en', $comment->language()->getId());
@@ -84,7 +84,7 @@ public function testMigration() {

    $comment = Comment::load(3);
    $this->assertSame('The second comment.', $comment->subject->value);
    $this->assertSame(NULL, $comment->pid->target_id);
    $this->assertNull($comment->pid->target_id);
    $this->assertSame('203.0.113.3', $comment->getHostname());

    $node = $comment->getCommentedEntity();
+8 −8
Original line number Diff line number Diff line
@@ -39,18 +39,18 @@ public function testSystemSite() {
    $config_translation = $language_manager->getLanguageConfigOverride('fr', 'system.site');
    $this->assertSame('The Site Name', $config_translation->get('name'));
    $this->assertSame('fr - The Slogan', $config_translation->get('slogan'));
    $this->assertSame(NULL, $config_translation->get('page.403'));
    $this->assertSame(NULL, $config_translation->get('page.404'));
    $this->assertSame(NULL, $config_translation->get('page.front'));
    $this->assertSame(NULL, $config_translation->get('admin_compact_mode'));
    $this->assertNull($config_translation->get('page.403'));
    $this->assertNull($config_translation->get('page.404'));
    $this->assertNull($config_translation->get('page.front'));
    $this->assertNull($config_translation->get('admin_compact_mode'));

    $config_translation = $language_manager->getLanguageConfigOverride('is', 'system.site');
    $this->assertSame('is - The Site Name', $config_translation->get('name'));
    $this->assertSame('is - The Slogan', $config_translation->get('slogan'));
    $this->assertSame(NULL, $config_translation->get('page.403'));
    $this->assertSame(NULL, $config_translation->get('page.404'));
    $this->assertSame(NULL, $config_translation->get('page.front'));
    $this->assertNULL($config_translation->get('admin_compact_mode'));
    $this->assertNull($config_translation->get('page.403'));
    $this->assertNull($config_translation->get('page.404'));
    $this->assertNull($config_translation->get('page.front'));
    $this->assertNull($config_translation->get('admin_compact_mode'));
  }

}
+3 −3
Original line number Diff line number Diff line
@@ -385,12 +385,12 @@ public function testGetWeight() {
   */
  public function testPopulateFromRouteMatch() {
    // Make sure the language code is not set initially.
    $this->assertSame(NULL, $this->configNamesMapper->getInternalLangcode());
    $this->assertNull($this->configNamesMapper->getInternalLangcode());

    // Test that an empty request does not set the language code.
    $route_match = new RouteMatch('example', new Route('/test/{langcode}'));
    $this->configNamesMapper->populateFromRouteMatch($route_match);
    $this->assertSame(NULL, $this->configNamesMapper->getInternalLangcode());
    $this->assertNull($this->configNamesMapper->getInternalLangcode());

    // Test that a request with a 'langcode' attribute sets the language code.
    $route_match = new RouteMatch('example', new Route('/test/{langcode}'), ['langcode' => 'xx']);
@@ -400,7 +400,7 @@ public function testPopulateFromRouteMatch() {
    // Test that the language code gets unset with the wrong request.
    $route_match = new RouteMatch('example', new Route('/test/{langcode}'));
    $this->configNamesMapper->populateFromRouteMatch($route_match);
    $this->assertSame(NULL, $this->configNamesMapper->getInternalLangcode());
    $this->assertNull($this->configNamesMapper->getInternalLangcode());
  }

  /**
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ public function testRead() {
    // 8b. Single related item, empty.
    $single_output = Json::decode($this->drupalGet('/jsonapi/node/article/' . $uuid . '/field_heroless'));
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSame(NULL, $single_output['data']);
    $this->assertNull($single_output['data']);
    // 9. Related tags with includes.
    $single_output = Json::decode($this->drupalGet('/jsonapi/node/article/' . $uuid . '/field_tags', [
      'query' => ['include' => 'vid'],
+3 −3
Original line number Diff line number Diff line
@@ -92,18 +92,18 @@ public function testGetLangcode() {
    $languageNegotiationContentEntity->setLanguageManager($this->languageManager);

    // Case 1: NULL request object argument.
    $this->assertSame(NULL, $languageNegotiationContentEntity->getLangcode());
    $this->assertNull($languageNegotiationContentEntity->getLangcode());

    // Case 2: A request object is available, but the languageManager is not
    // set.
    $request = Request::create('/foo', 'GET');
    $this->assertSame(NULL, $languageNegotiationContentEntity->getLangcode($request));
    $this->assertNull($languageNegotiationContentEntity->getLangcode($request));

    // Case 3: A request object is available, but static::QUERY_PARAMETER is
    // set to a non-enabled language.
    $request = Request::create('/foo', 'GET',
      [LanguageNegotiationContentEntity::QUERY_PARAMETER => 'it']);
    $this->assertSame(NULL, $languageNegotiationContentEntity->getLangcode($request));
    $this->assertNull($languageNegotiationContentEntity->getLangcode($request));

    // Case 4: A request object is available and static::QUERY_PARAMETER is
    // set to an enabled language.
Loading