Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/dataninja.cn/core/modules/system/tests/src/Kernel/Scripts/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/dataninja.cn/core/modules/system/tests/src/Kernel/Scripts/DbDumpCommandTest.php

<?php

namespace Drupal\Tests\system\Kernel\Scripts;

use Drupal\Core\Command\DbDumpCommand;
use Drupal\Core\Database\Database;
use Drupal\KernelTests\KernelTestBase;
use Symfony\Component\Console\Tester\CommandTester;

/**
 * Test that the DbDumpCommand works correctly.
 *
 * @group console
 */
class DbDumpCommandTest extends KernelTestBase {

  /**
   * {@inheritdoc}
   */
  public static $modules = ['system'];

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    // Determine what database backend is running, and set the skip flag.
    if (Database::getConnection()->databaseType() !== 'mysql') {
      $this->markTestSkipped("Skipping test since the DbDumpCommand is currently only compatible with MySQL");
    }

    // Rebuild the router to ensure a routing table.
    \Drupal::service('router.builder')->rebuild();

    /** @var \Drupal\Core\Database\Connection $connection */
    $connection = $this->container->get('database');
    $connection->insert('router')->fields(['name', 'path', 'pattern_outline'])->values(['test', 'test', 'test'])->execute();
  }

  /**
   * Test the command directly.
   */
  public function testDbDumpCommand() {
    $command = new DbDumpCommand();
    $command_tester = new CommandTester($command);
    $command_tester->execute([]);

    // Assert that insert exists and that some expected fields exist.
    $output = $command_tester->getDisplay();
    $this->assertContains("createTable('router", $output, 'Table router found');
    $this->assertContains("insert('router", $output, 'Insert found');
    $this->assertContains("'name' => 'test", $output, 'Insert name field found');
    $this->assertContains("'path' => 'test", $output, 'Insert path field found');
    $this->assertContains("'pattern_outline' => 'test", $output, 'Insert pattern_outline field found');
    $this->assertContains("// @codingStandardsIgnoreFile", $output);
  }

  /**
   * Test schema only option.
   */
  public function testSchemaOnly() {
    $command = new DbDumpCommand();
    $command_tester = new CommandTester($command);
    $command_tester->execute(['--schema-only' => 'router']);

    // Assert that insert statement doesn't exist for schema only table.
    $output = $command_tester->getDisplay();
    $this->assertContains("createTable('router", $output, 'Table router found');
    $this->assertNotContains("insert('router", $output, 'Insert not found');
    $this->assertNotContains("'name' => 'test", $output, 'Insert name field not found');
    $this->assertNotContains("'path' => 'test", $output, 'Insert path field not found');
    $this->assertNotContains("'pattern_outline' => 'test", $output, 'Insert pattern_outline field not found');

    // Assert that insert statement doesn't exist for wildcard schema only match.
    $command_tester->execute(['--schema-only' => 'route.*']);
    $output = $command_tester->getDisplay();
    $this->assertContains("createTable('router", $output, 'Table router found');
    $this->assertNotContains("insert('router", $output, 'Insert not found');
    $this->assertNotContains("'name' => 'test", $output, 'Insert name field not found');
    $this->assertNotContains("'path' => 'test", $output, 'Insert path field not found');
    $this->assertNotContains("'pattern_outline' => 'test", $output, 'Insert pattern_outline field not found');
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net