Changeset 48924
- Timestamp:
- 08/31/2020 10:41:02 PM (4 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/date/getCommentDate.php
r48912 r48924 11 11 * @ticket 51184 12 12 */ 13 function test_get_comment_date_returns_correct_time_with_comment_id() {13 public function test_get_comment_date_returns_correct_time_with_comment_id() { 14 14 $c = self::factory()->comment->create( array( 'comment_date' => '2020-08-29 01:51:00' ) ); 15 15 … … 20 20 * @ticket 51184 21 21 */ 22 function test_get_comment_date_returns_correct_time_with_empty_format() {22 public function test_get_comment_date_returns_correct_time_with_empty_format() { 23 23 $c = self::factory()->comment->create( array( 'comment_date' => '2020-08-29 01:51:00' ) ); 24 24 … … 30 30 * @ticket 51184 31 31 */ 32 function test_get_comment_time_returns_correct_time() {32 public function test_get_comment_time_returns_correct_time() { 33 33 $c = self::factory()->comment->create( array( 'comment_date' => '2020-08-29 01:51:00' ) ); 34 34 … … 40 40 * @ticket 51184 41 41 */ 42 function test_get_comment_time_returns_correct_time_with_empty_format() {42 public function test_get_comment_time_returns_correct_time_with_empty_format() { 43 43 $c = self::factory()->comment->create( array( 'comment_date' => '2020-08-29 01:51:00' ) ); 44 44 -
trunk/tests/phpunit/tests/date/getTheDate.php
r48912 r48924 11 11 * @ticket 13771 12 12 */ 13 function test_get_the_date_returns_correct_time_with_post_id() {13 public function test_get_the_date_returns_correct_time_with_post_id() { 14 14 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 15 15 … … 20 20 * @ticket 28310 21 21 */ 22 function test_get_the_date_returns_false_with_null_or_non_existing_post() {22 public function test_get_the_date_returns_false_with_null_or_non_existing_post() { 23 23 $this->assertFalse( get_the_date() ); 24 24 $this->assertFalse( get_the_date( 'F j, Y h:i:s' ) ); … … 30 30 * @ticket 51184 31 31 */ 32 function test_get_the_date_returns_correct_time_with_empty_format() {32 public function test_get_the_date_returns_correct_time_with_empty_format() { 33 33 $post_id = self::factory()->post->create( array( 'post_date' => '2020-08-29 01:51:00' ) ); 34 34 … … 40 40 * @ticket 28310 41 41 */ 42 function test_get_the_time_returns_correct_time_with_post_id() {42 public function test_get_the_time_returns_correct_time_with_post_id() { 43 43 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 44 44 … … 49 49 * @ticket 28310 50 50 */ 51 function test_get_the_time_returns_false_with_null_or_non_existing_post() {51 public function test_get_the_time_returns_false_with_null_or_non_existing_post() { 52 52 $this->assertFalse( get_the_time() ); 53 53 $this->assertFalse( get_the_time( 'h:i:s' ) ); … … 59 59 * @ticket 51184 60 60 */ 61 function test_get_the_time_returns_correct_time_with_empty_format() {61 public function test_get_the_time_returns_correct_time_with_empty_format() { 62 62 $post_id = self::factory()->post->create( array( 'post_date' => '2020-08-29 01:51:00' ) ); 63 63 -
trunk/tests/phpunit/tests/general/template.php
r48907 r48924 416 416 $this->custom_logo_id = $this->_make_attachment( $upload ); 417 417 return $this->custom_logo_id; 418 }419 420 /**421 * Test get_the_modified_time422 *423 * @ticket 37059424 *425 * @since 4.6.0426 */427 function test_get_the_modified_time_default() {428 $details = array(429 'post_date' => '2016-01-21 15:34:36',430 'post_date_gmt' => '2016-01-21 15:34:36',431 );432 $post_id = $this->factory->post->create( $details );433 $post = get_post( $post_id );434 435 $GLOBALS['post'] = $post;436 437 $expected = '1453390476';438 $format = 'G';439 $actual = get_the_modified_time( $format );440 $this->assertEquals( $expected, $actual );441 }442 443 /**444 * Test get_the_modified_time failures are filtered445 *446 * @ticket 37059447 *448 * @since 4.6.0449 */450 function test_get_the_modified_time_failures_are_filtered() {451 // Remove global post object.452 $GLOBALS['post'] = null;453 454 $expected = 'filtered modified time failure result';455 add_filter( 'get_the_modified_time', array( $this, '_filter_get_the_modified_time_failure' ) );456 $actual = get_the_modified_time();457 $this->assertEquals( $expected, $actual );458 remove_filter( 'get_the_modified_time', array( $this, '_filter_get_the_modified_time_failure' ) );459 }460 461 function _filter_get_the_modified_time_failure( $the_time ) {462 $expected = false;463 $actual = $the_time;464 $this->assertEquals( $expected, $actual );465 466 if ( false === $the_time ) {467 return 'filtered modified time failure result';468 }469 return $the_time;470 }471 472 /**473 * Test get_the_modified_time with post_id parameter.474 *475 * @ticket 37059476 *477 * @since 4.6.0478 */479 function test_get_the_modified_date_with_post_id() {480 $details = array(481 'post_date' => '2016-01-21 15:34:36',482 'post_date_gmt' => '2016-01-21 15:34:36',483 );484 $post_id = $this->factory->post->create( $details );485 $format = 'Y-m-d';486 $expected = '2016-01-21';487 $actual = get_the_modified_date( $format, $post_id );488 $this->assertEquals( $expected, $actual );489 }490 491 /**492 * Test get_the_modified_date493 *494 * @ticket 37059495 *496 * @since 4.6.0497 */498 function test_get_the_modified_date_default() {499 $details = array(500 'post_date' => '2016-01-21 15:34:36',501 'post_date_gmt' => '2016-01-21 15:34:36',502 );503 $post_id = $this->factory->post->create( $details );504 $post = get_post( $post_id );505 506 $GLOBALS['post'] = $post;507 508 $expected = '2016-01-21';509 $format = 'Y-m-d';510 $actual = get_the_modified_date( $format );511 $this->assertEquals( $expected, $actual );512 }513 514 /**515 * Test get_the_modified_date failures are filtered516 *517 * @ticket 37059518 *519 * @since 4.6.0520 */521 function test_get_the_modified_date_failures_are_filtered() {522 // Remove global post object.523 $GLOBALS['post'] = null;524 525 $expected = 'filtered modified date failure result';526 add_filter( 'get_the_modified_date', array( $this, '_filter_get_the_modified_date_failure' ) );527 $actual = get_the_modified_date();528 $this->assertEquals( $expected, $actual );529 remove_filter( 'get_the_modified_date', array( $this, '_filter_get_the_modified_date_failure' ) );530 }531 532 function _filter_get_the_modified_date_failure( $the_date ) {533 $expected = false;534 $actual = $the_date;535 $this->assertEquals( $expected, $actual );536 537 if ( false === $the_date ) {538 return 'filtered modified date failure result';539 }540 return $the_date;541 }542 543 /**544 * Test get_the_modified_time with post_id parameter.545 *546 * @ticket 37059547 *548 * @since 4.6.0549 */550 function test_get_the_modified_time_with_post_id() {551 $details = array(552 'post_date' => '2016-01-21 15:34:36',553 'post_date_gmt' => '2016-01-21 15:34:36',554 );555 $post_id = $this->factory->post->create( $details );556 $format = 'G';557 $expected = '1453390476';558 $actual = get_the_modified_time( $format, $post_id );559 $this->assertEquals( $expected, $actual );560 418 } 561 419
Note: See TracChangeset
for help on using the changeset viewer.