• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress develop tests

WordPress develop tests

WordPress develop tests a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Tests_Formatting_HumanTimeDiff::data_test_human_time_diff() –

You appear to be a bot. Output may be restricted

Description

Usage

Tests_Formatting_HumanTimeDiff::data_test_human_time_diff();

Parameters

Returns

void

Source

File name: wordpress-develop-tests/phpunit/tests/formatting/HumanTimeDiff.php


Lines:

1 to 55 of 55
  public function data_test_human_time_diff() {
    return array(
      array(
        '37 seconds',
        new DateTime( '2016-01-01 12:00:37' ),
        'Test a difference of 37 seconds.',
      ),
      array(
        '5 mins',
        new DateTime( '2016-01-01 12:05:00' ),
        'Test a difference of 5 minutes.',
      ),
      array(
        '1 hour',
        new DateTime( '2016-01-01 13:00:00' ),
        'Test a difference of 1 hour.',
      ),
      array(
        '2 days',
        new DateTime( '2016-01-03 12:00:00' ),
        'Test a difference of 2 days.',
      ),
      array(
        '2 hours',
        new DateTime( '2016-01-01 14:29:59' ),
        'Test a difference of 2 hours, 29 minutes and 59 seconds  - should round down to 2 hours.',
      ),
      array(
        '3 hours',
        new DateTime( '2016-01-01 14:30:00' ),
        'Test a difference of 2 hours and 30 minutes - should round up to 3 hours.',
      ),
      array(
        '2 months',
        new DateTime( '2016-02-15 12:00:00' ),
        'Test a difference of 1 month and 15 days - should round up to 2 months.',
      ),
      array(
        '1 month',
        new DateTime( '2016-02-14 12:00:00' ),
        'Test a difference of 1 month and 14 days - should round down to 1 month.',
      ),
      array(
        '3 years',
        new DateTime( '2018-07-02 12:00:00' ),
        'Test a difference of 2 years 6 months and 1 day, should round up to 3 years.',
      ),
      array(
        '2 years',
        new DateTime( '2018-07-01 12:00:00' ),
        'Test a difference of 2 years 6 months, should round down to 2 years.',
      ),
    );
  }
 

 View on GitHub

Published: 26th November 2019 | Last updated: 20th March 2022

Primary Sidebar

Information

Function name: Tests_Formatting_HumanTimeDiff::data_test_human_time_diff
Class ref: Tests_Formatting_HumanTimeDiff
Plugin ref: WordPress develop tests
Version: 5.9.3
Sourcefile: phpunit/tests/formatting/HumanTimeDiff.php
File ref: phpunit/tests/formatting/HumanTimeDiff.php
Deprecated?: No
API Letters: D,F,H,T

Footer

WordPress develop tests
WordPress develop tests
WordPress develop tests a2z
WordPress 6.4.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  develop.wp-a2z.org
© Copyright WordPress develop tests 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites