Verified Commit dc40b4e7 authored by Dave Long's avatar Dave Long
Browse files

task: #3551596 Add return types to core/tests code via Rector - round 1

By: mondrake
By: dcam
By: longwave
(cherry picked from commit 73792d76)
parent 325f82b3
Loading
Loading
Loading
Loading
Loading
+292 −2332

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ abstract class MigrateSqlSourceTestBase extends MigrateSourceTestBase {
  /**
   * {@inheritdoc}
   */
  public function register(ContainerBuilder $container) {
  public function register(ContainerBuilder $container): void {
    parent::register($container);
    $container
      ->register('cache_factory', MemoryCounterBackendFactory::class)
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ public function getPathReposForType($workspace_directory, $subdir) {
    return $data;
  }

  public static function provideTemplateCreateProject() {
  public static function provideTemplateCreateProject(): array {
    return [
      'recommended-project' => [
        'drupal/recommended-project',
+8 −8
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ public function getWorkspaceDirectory() {
   * @param string $expected
   *   Text we expect to find in the error output of the command.
   */
  public function assertErrorOutputContains($expected) {
  public function assertErrorOutputContains($expected): void {
    $this->assertStringContainsString($expected, $this->commandProcess->getErrorOutput());
  }

@@ -278,7 +278,7 @@ public function assertErrorOutputContains($expected) {
   * @param string $expected
   *   Text we expect not to find in the error output of the command.
   */
  public function assertErrorOutputNotContains($expected) {
  public function assertErrorOutputNotContains($expected): void {
    $this->assertStringNotContainsString($expected, $this->commandProcess->getErrorOutput());
  }

@@ -288,7 +288,7 @@ public function assertErrorOutputNotContains($expected) {
   * @param string $expected
   *   Text we expect to find in the output of the command.
   */
  public function assertCommandOutputContains($expected) {
  public function assertCommandOutputContains($expected): void {
    $this->assertStringContainsString($expected, $this->commandProcess->getOutput());
  }

@@ -300,8 +300,8 @@ public function assertCommandOutputContains($expected) {
   * If you need to assert a different exit code, then you can use
   * executeCommand() and perform a different assertion on the process object.
   */
  public function assertCommandSuccessful() {
    return $this->assertCommandExitCode(0);
  public function assertCommandSuccessful(): void {
    $this->assertCommandExitCode(0);
  }

  /**
@@ -310,7 +310,7 @@ public function assertCommandSuccessful() {
   * @param int $expected_code
   *   The expected process exit code.
   */
  public function assertCommandExitCode($expected_code) {
  public function assertCommandExitCode($expected_code): void {
    $this->assertEquals($expected_code, $this->commandProcess->getExitCode(),
      'COMMAND: ' . $this->commandProcess->getCommandLine() . "\n" .
      'OUTPUT: ' . $this->commandProcess->getOutput() . "\n" .
@@ -345,7 +345,7 @@ public function executeCommand($command_line, $working_dir = NULL) {
   * This method asserts that the X-Generator header shows that the site is a
   * Drupal site.
   */
  public function assertDrupalVisit() {
  public function assertDrupalVisit(): void {
    $this->getMink()->assertSession()->responseHeaderMatches('X-Generator', '/Drupal \d+ \(https:\/\/www.drupal.org\)/');
  }

@@ -559,7 +559,7 @@ protected function getPortNumber(): int {
   *   (optional) Relative path within the test workspace file system that will
   *   contain the copy of the codebase. Defaults to the workspace directory.
   */
  public function copyCodebase(?\Iterator $iterator = NULL, $working_dir = NULL) {
  public function copyCodebase(?\Iterator $iterator = NULL, $working_dir = NULL): void {
    $working_path = $this->getWorkingPath($working_dir);

    if ($iterator === NULL) {
+2 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ abstract class QuickStartTestBase extends BuildTestBase {
   *   (optional) A working directory relative to the workspace, within which to
   *   execute the command. Defaults to the workspace directory.
   */
  public function installQuickStart($profile, $working_dir = NULL) {
  public function installQuickStart($profile, $working_dir = NULL): void {
    $php_finder = new PhpExecutableFinder();
    $install_process = $this->executeCommand($php_finder->find() . ' ./core/scripts/drupal install ' . $profile, $working_dir);
    $this->assertCommandOutputContains('Username:');
@@ -55,7 +55,7 @@ public function installQuickStart($profile, $working_dir = NULL) {
   *   (optional) A working directory within which to login. Defaults to the
   *   workspace directory.
   */
  public function formLogin($username, $password, $working_dir = NULL) {
  public function formLogin($username, $password, $working_dir = NULL): void {
    $this->visit('/user/login', $working_dir);
    $assert = $this->getMink()->assertSession();
    $assert->statusCodeEquals(200);
Loading