Commit d0cc4b86 authored by Ilcho Vuchkov's avatar Ilcho Vuchkov Committed by Ilcho Vuchkov
Browse files

Issue #3297428 by Project Update Bot, vuil: Automated Drupal 10 compatibility fixes

parent 318a4bb4
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -7,15 +7,19 @@

namespace Drupal\imotilux\ProxyClass {

    use Drupal\Core\Extension\ModuleUninstallValidatorInterface;
    use Drupal\Core\DependencyInjection\DependencySerializationTrait;
    use Symfony\Component\DependencyInjection\ContainerInterface;
    use Drupal\Core\StringTranslation\TranslationInterface;
    /**
     * Provides a proxy class for \Drupal\imotilux\ImotiluxUninstallValidator.
     *
     * @see \Drupal\Component\ProxyBuilder
     */
    class ImotiluxUninstallValidator implements \Drupal\Core\Extension\ModuleUninstallValidatorInterface
    class ImotiluxUninstallValidator implements ModuleUninstallValidatorInterface
    {

        use \Drupal\Core\DependencyInjection\DependencySerializationTrait;
        use DependencySerializationTrait;

        /**
         * The id of the original proxied service.
@@ -46,7 +50,7 @@ namespace Drupal\imotilux\ProxyClass {
         * @param string $drupal_proxy_original_service_id
         *   The service ID of the original service.
         */
        public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container, $drupal_proxy_original_service_id)
        public function __construct(ContainerInterface $container, $drupal_proxy_original_service_id)
        {
            $this->container = $container;
            $this->drupalProxyOriginalServiceId = $drupal_proxy_original_service_id;
@@ -78,7 +82,7 @@ namespace Drupal\imotilux\ProxyClass {
        /**
         * {@inheritdoc}
         */
        public function setStringTranslation(\Drupal\Core\StringTranslation\TranslationInterface $translation)
        public function setStringTranslation(TranslationInterface $translation)
        {
            return $this->lazyLoadItself()->setStringTranslation($translation);
        }
+19 −15
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ class ImotiluxBreadcrumbTest extends BrowserTestBase {
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
  protected function setUp(): void {
    parent::setUp();
    $this->drupalPlaceBlock('system_breadcrumb_block');
    $this->drupalPlaceBlock('page_title_block');
@@ -125,16 +125,18 @@ class ImotiluxBreadcrumbTest extends BrowserTestBase {
    $edit['imotilux[bid]'] = $imotilux_nid;

    if ($parent !== NULL) {
      $this->drupalPostForm('node/add/imotilux', $edit, t('Change imotilux (update list of parents)'));
      $this->drupalGet('node/add/imotilux');
      $this->submitForm($edit, t('Change imotilux (update list of parents)'));

      $edit['imotilux[pid]'] = $parent;
      $this->drupalPostForm(NULL, $edit, t('Save'));
      $this->submitForm($edit, t('Save'));
      // Make sure the parent was flagged as having children.
      $parent_node = $this->entityTypeManager->getStorage('node')->loadUnchanged($parent);
      $this->assertFalse(empty($parent_node->imotilux['has_children']), 'Parent node is marked as having children');
    }
    else {
      $this->drupalPostForm('node/add/imotilux', $edit, t('Save'));
      $this->drupalGet('node/add/imotilux');
      $this->submitForm($edit, t('Save'));
    }

    // Check to make sure the imotilux node was created.
@@ -163,12 +165,13 @@ class ImotiluxBreadcrumbTest extends BrowserTestBase {
      $got_breadcrumb[] = $link->getText();
    }
    // Home link and four parent imotilux nodes should be in the breadcrumb.
    $this->assertEqual(5, count($got_breadcrumb));
    $this->assertEqual($nodes[3]->getTitle(), end($got_breadcrumb));
    $this->assertEquals(5, count($got_breadcrumb));
    $this->assertEquals($nodes[3]->getTitle(), end($got_breadcrumb));
    $edit = [
      'title[0][value]' => 'Updated node5 title',
    ];
    $this->drupalPostForm($nodes[3]->toUrl('edit-form'), $edit, 'Save');
    $this->drupalGet($nodes[3]->toUrl('edit-form'));
    $this->submitForm($edit, 'Save');
    $this->drupalGet($nodes[4]->toUrl());
    // Fetch each node title in the current breadcrumb.
    $links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
@@ -176,8 +179,8 @@ class ImotiluxBreadcrumbTest extends BrowserTestBase {
    foreach ($links as $link) {
      $got_breadcrumb[] = $link->getText();
    }
    $this->assertEqual(5, count($got_breadcrumb));
    $this->assertEqual($edit['title[0][value]'], end($got_breadcrumb));
    $this->assertEquals(5, count($got_breadcrumb));
    $this->assertEquals($edit['title[0][value]'], end($got_breadcrumb));
  }

  /**
@@ -190,15 +193,16 @@ class ImotiluxBreadcrumbTest extends BrowserTestBase {
    $edit = [
      'title[0][value]' => "you can't see me",
    ];
    $this->drupalPostForm($nodes[3]->toUrl('edit-form'), $edit, 'Save');
    $this->drupalGet($nodes[3]->toUrl('edit-form'));
    $this->submitForm($edit, 'Save');
    $this->drupalGet($nodes[4]->toUrl());
    $links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
    $got_breadcrumb = [];
    foreach ($links as $link) {
      $got_breadcrumb[] = $link->getText();
    }
    $this->assertEqual(5, count($got_breadcrumb));
    $this->assertEqual($edit['title[0][value]'], end($got_breadcrumb));
    $this->assertEquals(5, count($got_breadcrumb));
    $this->assertEquals($edit['title[0][value]'], end($got_breadcrumb));
    $config = $this->container->get('config.factory')->getEditable('imotilux_breadcrumb_test.settings');
    $config->set('hide', TRUE)->save();
    $this->drupalGet($nodes[4]->toUrl());
@@ -207,10 +211,10 @@ class ImotiluxBreadcrumbTest extends BrowserTestBase {
    foreach ($links as $link) {
      $got_breadcrumb[] = $link->getText();
    }
    $this->assertEqual(4, count($got_breadcrumb));
    $this->assertEqual($nodes[2]->getTitle(), end($got_breadcrumb));
    $this->assertEquals(4, count($got_breadcrumb));
    $this->assertEquals($nodes[2]->getTitle(), end($got_breadcrumb));
    $this->drupalGet($nodes[3]->toUrl());
    $this->assertResponse(403);
    $this->assertSession()->statusCodeEquals(403);
  }

}
+17 −9
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ class ImotiluxContentModerationTest extends BrowserTestBase {
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
  protected function setUp(): void {
    parent::setUp();

    $this->drupalPlaceBlock('system_breadcrumb_block');
@@ -63,33 +63,38 @@ class ImotiluxContentModerationTest extends BrowserTestBase {
      'title[0][value]' => $this->randomString(),
      'moderation_state[0][state]' => 'published',
    ];
    $this->drupalPostForm('node/add/imotilux', $edit, t('Save'));
    $this->drupalGet('node/add/imotilux');
    $this->submitForm($edit, t('Save'));
    $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
    $this->assertTrue($node);

    $edit = [
      'moderation_state[0][state]' => 'draft',
    ];
    $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
    $this->drupalGet('node/' . $node->id() . '/edit');
    $this->submitForm($edit, t('Save'));
    $this->assertSession()->pageTextNotContains('You can only change the imotilux outline for the published version of this content.');

    // Create a imotilux draft with no changes, then publish it.
    $edit = [
      'moderation_state[0][state]' => 'draft',
    ];
    $this->drupalPostForm('node/' . $imotilux_1->id() . '/edit', $edit, t('Save'));
    $this->drupalGet('node/' . $imotilux_1->id() . '/edit');
    $this->submitForm($edit, t('Save'));
    $this->assertSession()->pageTextNotContains('You can only change the imotilux outline for the published version of this content.');
    $edit = [
      'moderation_state[0][state]' => 'published',
    ];
    $this->drupalPostForm('node/' . $imotilux_1->id() . '/edit', $edit, t('Save'));
    $this->drupalGet('node/' . $imotilux_1->id() . '/edit');
    $this->submitForm($edit, t('Save'));

    // Try to move Node 2 to a different parent.
    $edit = [
      'imotilux[pid]' => $imotilux_1_nodes[3]->id(),
      'moderation_state[0][state]' => 'draft',
    ];
    $this->drupalPostForm('node/' . $imotilux_1_nodes[1]->id() . '/edit', $edit, t('Save'));
    $this->drupalGet('node/' . $imotilux_1_nodes[1]->id() . '/edit');
    $this->submitForm($edit, t('Save'));

    $this->assertSession()->pageTextContains('You can only change the imotilux outline for the published version of this content.');

@@ -103,7 +108,8 @@ class ImotiluxContentModerationTest extends BrowserTestBase {
      'imotilux[bid]' => $imotilux_2->id(),
      'moderation_state[0][state]' => 'draft',
    ];
    $this->drupalPostForm('node/' . $imotilux_1_nodes[1]->id() . '/edit', $edit, t('Save'));
    $this->drupalGet('node/' . $imotilux_1_nodes[1]->id() . '/edit');
    $this->submitForm($edit, t('Save'));

    $this->assertSession()->pageTextContains('You can only change the imotilux outline for the published version of this content.');

@@ -117,7 +123,8 @@ class ImotiluxContentModerationTest extends BrowserTestBase {
      'imotilux[weight]' => 2,
      'moderation_state[0][state]' => 'draft',
    ];
    $this->drupalPostForm('node/' . $imotilux_1_nodes[1]->id() . '/edit', $edit, t('Save'));
    $this->drupalGet('node/' . $imotilux_1_nodes[1]->id() . '/edit');
    $this->submitForm($edit, t('Save'));

    $this->assertSession()->pageTextContains('You can only change the imotilux outline for the published version of this content.');

@@ -131,7 +138,8 @@ class ImotiluxContentModerationTest extends BrowserTestBase {
    $edit = [
      'moderation_state[0][state]' => 'draft',
    ];
    $this->drupalPostForm('node/' . $imotilux_1_nodes[1]->id() . '/edit', $edit, t('Save'));
    $this->drupalGet('node/' . $imotilux_1_nodes[1]->id() . '/edit');
    $this->submitForm($edit, t('Save'));

    $this->assertSession()->pageTextNotContains('You can only change the imotilux outline for the published version of this content.');
  }
+7 −5
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ class ImotiluxRelationshipTest extends ViewTestBase {
  /**
   * {@inheritdoc}
   */
  protected function setUp($import_test_views = TRUE) {
  protected function setUp($import_test_views = TRUE): void {
    parent::setUp($import_test_views);

    // Create users.
@@ -123,16 +123,18 @@ class ImotiluxRelationshipTest extends ViewTestBase {
    $edit['imotilux[bid]'] = $imotilux_nid;

    if ($parent !== NULL) {
      $this->drupalPostForm('node/add/imotilux', $edit, t('Change imotilux (update list of parents)'));
      $this->drupalGet('node/add/imotilux');
      $this->submitForm($edit, t('Change imotilux (update list of parents)'));

      $edit['imotilux[pid]'] = $parent;
      $this->drupalPostForm(NULL, $edit, t('Save'));
      $this->submitForm($edit, t('Save'));
      // Make sure the parent was flagged as having children.
      $parent_node = $this->entityTypeManager->getStorage('node')->loadUnchanged($parent);
      $this->assertFalse(empty($parent_node->imotilux['has_children']), 'Parent node is marked as having children');
    }
    else {
      $this->drupalPostForm('node/add/imotilux', $edit, t('Save'));
      $this->drupalGet('node/add/imotilux');
      $this->submitForm($edit, t('Save'));
    }

    // Check to make sure the imotilux node was created.
@@ -155,7 +157,7 @@ class ImotiluxRelationshipTest extends ViewTestBase {
      $this->drupalGet('test-imotilux/' . $nodes[$i]->id());

      for ($j = 0; $j < $i; $j++) {
        $this->assertLink($nodes[$j]->label());
        $this->assertSession()->linkExists($nodes[$j]->label());
      }
    }
  }
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ class ImotiluxPendingRevisionTest extends KernelTestBase {
  /**
   * The mocked entity manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManager|\PHPUnit_Framework_MockObject_MockObject
   * @var \Drupal\Core\Entity\EntityTypeManager|\PHPUnit\Framework\MockObject\MockObject
   */
  protected $entityTypeManager;

@@ -30,7 +30,7 @@ class ImotiluxPendingRevisionTest extends KernelTestBase {
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
  protected function setUp(): void {
    parent::setUp();

    $this->installEntitySchema('user');
Loading