Verified Commit 263ce2a8 authored by Jess's avatar Jess
Browse files

Issue #3397890 by mstrelan, xjm, dww, acbramley: Fix strict type errors in unit tests

parent 8ef50c83
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public function testUnbannedIp() {

    $request = Request::create('/test-path');
    $request->server->set('REMOTE_ADDR', $unbanned_ip);
    $expected_response = new Response(200);
    $expected_response = new Response(status: 200);
    $this->kernel->expects($this->once())
      ->method('handle')
      ->with($request, HttpKernelInterface::MAIN_REQUEST, TRUE)
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ public function testGetUpgradeStates($modules_to_enable, $files, $field_plugins,

    foreach ($files as $module => $contents) {
      $path = $url . '/' . $module . '/migrations/state';
      mkdir($path, '0755', TRUE);
      mkdir($path, 0755, TRUE);
      file_put_contents($path . '/' . $module . '.migrate_drupal.yml', $contents);
    }
    $moduleHandler->getModuleDirectories()
+1 −1
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ public function providerLongPasswords() {

    // Check a string of 3-byte UTF-8 characters, 510 byte long password is
    // allowed.
    $len = floor(PasswordInterface::PASSWORD_MAX_LENGTH / 3);
    $len = (int) floor(PasswordInterface::PASSWORD_MAX_LENGTH / 3);
    $diff = PasswordInterface::PASSWORD_MAX_LENGTH % 3;
    $passwords['utf8'] = [str_repeat('€', $len), TRUE];
    // 512 byte long password is allowed.
+3 −3
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ public function testUpdateFetcherNoFallback() {
    // First, try without the HTTP fallback setting, and HTTPS mocked to fail.
    $settings = new Settings([]);
    $this->mockClient(
      new Response('500', [], 'HTTPS failed'),
      new Response(500, [], 'HTTPS failed'),
    );
    $update_fetcher = new UpdateFetcher($this->mockConfigFactory, $this->mockHttpClient, $settings, $this->logger);

@@ -206,8 +206,8 @@ public function testUpdateFetcherNoFallback() {
  public function testUpdateFetcherHttpFallback() {
    $settings = new Settings(['update_fetch_with_http_fallback' => TRUE]);
    $this->mockClient(
      new Response('500', [], 'HTTPS failed'),
      new Response('200', [], 'HTTP worked'),
      new Response(500, [], 'HTTPS failed'),
      new Response(200, [], 'HTTP worked'),
    );
    $update_fetcher = new UpdateFetcher($this->mockConfigFactory, $this->mockHttpClient, $settings, $this->logger);

+4 −4
Original line number Diff line number Diff line
@@ -186,7 +186,7 @@ public function testDateTimestamp($input, array $initial, array $transform) {
   *
   * @param \Drupal\Component\Datetime\DateTimePlus $date
   *   DateTimePlus to test.
   * @param string $input
   * @param string|int $input
   *   The original input passed to the test method.
   * @param array $initial
   *   @see testTimestamp()
@@ -195,7 +195,7 @@ public function testDateTimestamp($input, array $initial, array $transform) {
   *
   * @internal
   */
  public function assertDateTimestamp(DateTimePlus $date, string $input, array $initial, array $transform): void {
  public function assertDateTimestamp(DateTimePlus $date, string|int $input, array $initial, array $transform): void {
    // Check format.
    $value = $date->format($initial['format']);
    $this->assertEquals($initial['expected_date'], $value, sprintf("Test new DateTimePlus(%s, %s): should be %s, found %s.", $input, $initial['timezone'], $initial['expected_date'], $value));
@@ -694,7 +694,7 @@ public function providerTestDateDiff() {
      ],
      [
        'input1' => DateTimePlus::createFromFormat('U', 3600),
        'input2' => \DateTime::createFromFormat('U', 0),
        'input2' => \DateTime::createFromFormat('U', '0'),
        'absolute' => FALSE,
        'expected' => $negative_1_hour,
      ],
@@ -706,7 +706,7 @@ public function providerTestDateDiff() {
      ],
      [
        'input1' => DateTimePlus::createFromFormat('U', 3600),
        'input2' => \DateTime::createFromFormat('U', 0),
        'input2' => \DateTime::createFromFormat('U', '0'),
        'absolute' => TRUE,
        'expected' => $positive_1_hour,
      ],
Loading