Unverified Commit 66f55381 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3112681 by Hardik_Patel_12: Remove all @deprecated code from Datetime component

parent b17acb2b
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -57,22 +57,6 @@ public function getCacheMaxAge() {
    return $this->maxAge;
  }

  /**
   * The maximum age for which this object may be cached.
   *
   * @return int
   *   The maximum time in seconds that this object may be cached.
   *
   * @deprecated in drupal:8.1.9 and is removed from drupal:9.0.0. Use
   *   \Drupal\Core\Datetime\FormattedDateDiff::getCacheMaxAge() instead.
   *
   * @see https://www.drupal.org/node/2783545
   */
  public function getMaxAge() {
    @trigger_error(__NAMESPACE__ . '\FormattedDateDiff::getMaxAge() is deprecated in drupal:8.1.9 and is removed from drupal:9.0.0. Use \Drupal\Core\Datetime\FormattedDateDiff::getCacheMaxAge() instead. See https://www.drupal.org/node/2783545', E_USER_DEPRECATED);
    return $this->getCacheMaxAge();
  }

  /**
   * {@inheritdoc}
   */
+0 −14
Original line number Diff line number Diff line
@@ -423,20 +423,6 @@ public function testFormattedDateDiff() {
    $this->assertEquals($max_age, $build['#cache']['max-age']);
  }

  /**
   * Tests FormattedDateDiff.
   *
   * @covers \Drupal\Core\Datetime\FormattedDateDiff::getMaxAge
   * @group legacy
   * @expectedDeprecation Drupal\Core\Datetime\FormattedDateDiff::getMaxAge() is deprecated in drupal:8.1.9 and is removed from drupal:9.0.0. Use \Drupal\Core\Datetime\FormattedDateDiff::getCacheMaxAge() instead. See https://www.drupal.org/node/2783545
   */
  public function testLegacyMaxAgeFormattedDateDiff() {
    $string = '10 minutes';
    $max_age = 60;
    $object = new FormattedDateDiff($string, $max_age);
    $this->assertSame($object->getCacheMaxAge(), $object->getMaxAge());
  }

  /**
   * Creates a UNIX timestamp given a date and time string in the format
   * year-month-day hour:minute:seconds (e.g. 2013-12-11 10:09:08).