Commit 6ca4984f authored by catch's avatar catch
Browse files

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

Issue #3351079 by Spokje: Fix PHPStan L1 errors "You should use assertFoo() instead of assertSame(foo, $actual)."
parent 336c3ef2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ public function testLanguageContentMenu() {
    $this->assertSame('menu_link_content', $config->getTargetEntityTypeId());
    $this->assertSame('menu_link_content', $config->getTargetBundle());
    $this->assertSame(LanguageInterface::LANGCODE_SITE_DEFAULT, $config->getDefaultLangcode());
    $this->assertSame(TRUE, $config->isLanguageAlterable());
    $this->assertTrue($config->isLanguageAlterable());
    $settings = [
      'enabled' => TRUE,
      'bundle_settings' => [
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ public function testEmbeddedData() {
    $this->assertSame($data_rows, $results);

    // Validate the public APIs.
    $this->assertSame(count($data_rows), $source->count());
    $this->assertSameSize($data_rows, $source);
    $this->assertSame($ids, $source->getIds());
    $expected_fields = [
      'key' => 'key',
+4 −4
Original line number Diff line number Diff line
@@ -78,8 +78,8 @@ public function testCacheCountsNotContaminated() {
    $this->assertSame(2, $migration_2_source->count(TRUE));

    // Verify correct counts are cached.
    $this->assertSame(1, $migration_1_source->count());
    $this->assertSame(2, $migration_2_source->count());
    $this->assertCount(1, $migration_1_source);
    $this->assertCount(2, $migration_2_source);

    // Verify the cache keys are different.
    $cache_key_property = new \ReflectionProperty(SourcePluginBase::class, 'cacheKey');
@@ -108,14 +108,14 @@ public function testCacheCountsUsed() {
    ];
    $migration = $this->migrationPluginManager->createStubMigration($migration_definition);
    $migration_source = $migration->getSourcePlugin();
    $this->assertSame(2, $migration_source->count());
    $this->assertCount(2, $migration_source);

    // Pollute the cache.
    $cache_key_property = new \ReflectionProperty($migration_source, 'cacheKey');
    $cache_key_property->setAccessible(TRUE);
    $cache_key = $cache_key_property->getValue($migration_source);
    \Drupal::cache('migrate')->set($cache_key, 7);
    $this->assertSame(7, $migration_source->count());
    $this->assertCount(7, $migration_source);
    $this->assertSame(2, $migration_source->count(TRUE));
  }

+1 −1
Original line number Diff line number Diff line
@@ -721,7 +721,7 @@ public function testFieldapiField() {
    $this->executeView($view);

    $result = Json::decode($this->drupalGet('test/serialize/node-field', ['query' => ['_format' => 'json']]));
    $this->assertSame($node->body->count(), count($result[2]['body']), 'Expected count of values');
    $this->assertCount($node->body->count(), $result[2]['body']);
    $this->assertEquals($result[2]['body'], array_map(function ($item) {
      return $item['value'];
    }, $node->body->getValue()), 'Expected raw body values found.');
+2 −2
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ public function testSanitizeNameNoMunge(string $filename, string $allowed_extens

    // Check the results of the configured sanitization.
    $this->assertSame($filename, $event->getFilename());
    $this->assertSame(FALSE, $event->isSecurityRename());
    $this->assertFalse($event->isSecurityRename());

    $config_factory = $this->getConfigFactoryStub([
      'system.file' => [
@@ -128,7 +128,7 @@ public function testSanitizeNameNoMunge(string $filename, string $allowed_extens

    // Check the results of the configured sanitization.
    $this->assertSame($filename, $event->getFilename());
    $this->assertSame(FALSE, $event->isSecurityRename());
    $this->assertFalse($event->isSecurityRename());
  }

  /**
Loading