Commit 5132c83f authored by catch's avatar catch
Browse files

Issue #3082415 by Krzysztof Domański, mondrake, alexpott, longwave, jungle:...

Issue #3082415 by Krzysztof Domański, mondrake, alexpott, longwave, jungle: Replace assert(Not)Same/Identical() on booleans with assert(Not)True/False() in PHPUnit tests
parent de981ef8
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ public function testCRUD() {
    $this->assertIdentical($empty->language()->getId(), $default_langcode);

    // Verify ConfigEntity properties/methods on the newly created empty entity.
    $this->assertIdentical($empty->isNew(), TRUE);
    $this->assertTrue($empty->isNew());
    $this->assertIdentical($empty->getOriginalId(), NULL);
    $this->assertIdentical($empty->bundle(), 'config_test');
    $this->assertIdentical($empty->id(), NULL);
@@ -85,7 +85,7 @@ public function testCRUD() {
    $empty_id = $storage->create([
      'id' => '',
    ]);
    $this->assertIdentical($empty_id->isNew(), TRUE);
    $this->assertTrue($empty_id->isNew());
    try {
      $empty_id->save();
      $this->fail('EntityMalformedException was thrown.');
@@ -106,7 +106,7 @@ public function testCRUD() {
    $this->assertIdentical($config_test->language()->getId(), $default_langcode);

    // Verify methods on the newly created entity.
    $this->assertIdentical($config_test->isNew(), TRUE);
    $this->assertTrue($config_test->isNew());
    $this->assertIdentical($config_test->getOriginalId(), $expected['id']);
    $this->assertIdentical($config_test->id(), $expected['id']);
    $this->assertTrue(Uuid::isValid($config_test->uuid()));
@@ -130,7 +130,7 @@ public function testCRUD() {
    $this->assertIdentical($config_test->id(), $expected['id']);
    $this->assertIdentical($config_test->uuid(), $expected['uuid']);
    $this->assertIdentical($config_test->label(), $expected['label']);
    $this->assertIdentical($config_test->isNew(), FALSE);
    $this->assertFalse($config_test->isNew());
    $this->assertIdentical($config_test->getOriginalId(), $expected['id']);

    // Save again, and verify correct status and properties again.
@@ -139,7 +139,7 @@ public function testCRUD() {
    $this->assertIdentical($config_test->id(), $expected['id']);
    $this->assertIdentical($config_test->uuid(), $expected['uuid']);
    $this->assertIdentical($config_test->label(), $expected['label']);
    $this->assertIdentical($config_test->isNew(), FALSE);
    $this->assertFalse($config_test->isNew());
    $this->assertIdentical($config_test->getOriginalId(), $expected['id']);

    // Verify that a configuration entity can be saved with an ID of the
@@ -196,7 +196,7 @@ public function testCRUD() {
    $same_id = $storage->create([
      'id' => $config_test->id(),
    ]);
    $this->assertIdentical($same_id->isNew(), TRUE);
    $this->assertTrue($same_id->isNew());
    try {
      $same_id->save();
      $this->fail('Not possible to overwrite an entity entity.');
@@ -219,7 +219,7 @@ public function testCRUD() {
      $this->assertIdentical($config_test->id(), $new_id);
      $status = $config_test->save();
      $this->assertIdentical($status, SAVED_UPDATED);
      $this->assertIdentical($config_test->isNew(), FALSE);
      $this->assertFalse($config_test->isNew());

      // Verify that originalID points to new ID directly after renaming.
      $this->assertIdentical($config_test->id(), $new_id);
+2 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ public function testImport() {
    // Create updated configuration object.
    $new_site_name = 'Config import test ' . $this->randomString();
    $this->prepareSiteNameUpdate($new_site_name);
    $this->assertIdentical($sync->exists($name), TRUE, $name . ' found.');
    $this->assertTrue($sync->exists($name), $name . ' found.');

    // Create new config entity.
    $original_dynamic_data = [
@@ -74,7 +74,7 @@ public function testImport() {
      'protected_property' => '',
    ];
    $sync->write($dynamic_name, $original_dynamic_data);
    $this->assertIdentical($sync->exists($dynamic_name), TRUE, $dynamic_name . ' found.');
    $this->assertTrue($sync->exists($dynamic_name), $dynamic_name . ' found.');

    // Enable the Automated Cron and Ban modules during import. The Ban
    // module is used because it creates a table during the install.
+8 −8
Original line number Diff line number Diff line
@@ -53,9 +53,9 @@ public function testIntegrationModuleReinstallation() {

    // Verify the configuration does not exist prior to installation.
    $config_static = $this->config($default_config);
    $this->assertIdentical($config_static->isNew(), TRUE);
    $this->assertTrue($config_static->isNew());
    $config_entity = $this->config($default_configuration_entity);
    $this->assertIdentical($config_entity->isNew(), TRUE);
    $this->assertTrue($config_entity->isNew());

    // Install the integration module.
    \Drupal::service('module_installer')->install(['config_integration_test']);
@@ -65,10 +65,10 @@ public function testIntegrationModuleReinstallation() {
    \Drupal::configFactory()->reset($default_config);
    \Drupal::configFactory()->reset($default_configuration_entity);
    $config_static = $this->config($default_config);
    $this->assertIdentical($config_static->isNew(), FALSE);
    $this->assertFalse($config_static->isNew());
    $this->assertIdentical($config_static->get('foo'), 'default setting');
    $config_entity = $this->config($default_configuration_entity);
    $this->assertIdentical($config_entity->isNew(), FALSE);
    $this->assertFalse($config_entity->isNew());
    $this->assertIdentical($config_entity->get('label'), 'Default integration config label');

    // Customize both configuration objects.
@@ -86,11 +86,11 @@ public function testIntegrationModuleReinstallation() {

    // Verify the integration module's config was uninstalled.
    $config_static = $this->config($default_config);
    $this->assertIdentical($config_static->isNew(), TRUE);
    $this->assertTrue($config_static->isNew());

    // Verify the integration config still exists.
    $config_entity = $this->config($default_configuration_entity);
    $this->assertIdentical($config_entity->isNew(), FALSE);
    $this->assertFalse($config_entity->isNew());
    $this->assertIdentical($config_entity->get('label'), 'Customized integration config label');

    // Reinstall the integration module.
@@ -112,12 +112,12 @@ public function testIntegrationModuleReinstallation() {
    \Drupal::configFactory()->reset($default_config);
    \Drupal::configFactory()->reset($default_configuration_entity);
    $config_static = $this->config($default_config);
    $this->assertIdentical($config_static->isNew(), FALSE);
    $this->assertFalse($config_static->isNew());
    $this->assertIdentical($config_static->get('foo'), 'default setting');

    // Verify the integration config is using the default.
    $config_entity = \Drupal::config($default_configuration_entity);
    $this->assertIdentical($config_entity->isNew(), FALSE);
    $this->assertFalse($config_entity->isNew());
    $this->assertIdentical($config_entity->get('label'), 'Default integration config label');
  }

+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ protected function setUp(): void {
   */
  public function testContactSettings() {
    $config = $this->config('contact.settings');
    $this->assertIdentical(TRUE, $config->get('user_default_enabled'));
    $this->assertTrue($config->get('user_default_enabled'));
    $this->assertIdentical(3, $config->get('flood.limit'));
    $this->assertIdentical('some_other_category', $config->get('default_form'));
    $this->assertConfigSchema(\Drupal::service('config.typed'), 'contact.settings', $config->get());
+2 −2
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public function testConfigImportUpdates() {
    $sync = $this->container->get('config.storage.sync');

    // Verify the configuration to create does not exist yet.
    $this->assertIdentical($storage->exists($config_name), FALSE, $config_name . ' not found.');
    $this->assertFalse($storage->exists($config_name), $config_name . ' not found.');

    // Create new config entity.
    $data = [
@@ -87,7 +87,7 @@ public function testConfigImportUpdates() {
      ],
    ];
    $sync->write($config_name, $data);
    $this->assertIdentical($sync->exists($config_name), TRUE, $config_name . ' found.');
    $this->assertTrue($sync->exists($config_name), $config_name . ' found.');

    // Import.
    $this->configImporter->reset()->import();
Loading