- Timestamp:
- 08/31/2020 03:33:45 PM (4 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 1 added
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/date/getPostTime.php
r48910 r48911 4 4 * @group date 5 5 * @group datetime 6 * @group post 6 7 */ 7 class Tests_Date_Post_Time extends WP_UnitTestCase { 8 class Tests_Date_Get_Post_Time extends WP_UnitTestCase { 9 10 /** 11 * @ticket 28310 12 */ 13 public function test_get_post_time_with_id_returns_correct_time() { 14 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 15 $this->assertEquals( '16:35:00', get_post_time( 'H:i:s', false, $post_id ) ); 16 } 17 18 /** 19 * @ticket 28310 20 */ 21 public function test_get_post_time_returns_false_with_null_or_non_existing_post() { 22 $this->assertFalse( get_post_time() ); 23 $this->assertFalse( get_post_time( 'h:i:s' ) ); 24 $this->assertFalse( get_post_time( '', false, 9 ) ); 25 $this->assertFalse( get_post_time( 'h:i:s', false, 9 ) ); 26 } 27 28 /** 29 * @ticket 28310 30 */ 31 public function test_get_post_modified_time_with_id_returns_correct_time() { 32 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 33 $this->assertEquals( '16:35:00', get_post_modified_time( 'H:i:s', false, $post_id ) ); 34 } 35 36 /** 37 * @ticket 28310 38 */ 39 public function test_get_post_modified_time_returns_false_with_null_or_non_existing_post() { 40 $this->assertFalse( get_post_modified_time() ); 41 $this->assertFalse( get_post_modified_time( 'h:i:s' ) ); 42 $this->assertFalse( get_post_modified_time( '', false, 9 ) ); 43 $this->assertFalse( get_post_modified_time( 'h:i:s', false, 9 ) ); 44 } 8 45 9 46 /** -
trunk/tests/phpunit/tests/date/mysql2date.php
r47118 r48911 12 12 13 13 parent::tearDown(); 14 } 15 16 /** 17 * @ticket 28310 18 */ 19 function test_mysql2date_returns_false_with_no_date() { 20 $this->assertFalse( mysql2date( 'F j, Y H:i:s', '' ) ); 21 } 22 23 /** 24 * @ticket 28310 25 */ 26 function test_mysql2date_returns_gmt_or_unix_timestamp() { 27 $this->assertEquals( '441013392', mysql2date( 'G', '1983-12-23 07:43:12' ) ); 28 $this->assertEquals( '441013392', mysql2date( 'U', '1983-12-23 07:43:12' ) ); 14 29 } 15 30 -
trunk/tests/phpunit/tests/date/theDate.php
r46586 r48911 4 4 * @group date 5 5 * @group datetime 6 * @group post 6 7 */ 7 8 class Tests_Date_The_Date extends WP_UnitTestCase { -
trunk/tests/phpunit/tests/post.php
r48497 r48911 897 897 898 898 /** 899 * @ticket 13771900 */901 function test_get_the_date_with_id_returns_correct_time() {902 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );903 $this->assertEquals( 'March 1, 2014', get_the_date( 'F j, Y', $post_id ) );904 }905 906 /**907 * @ticket 28310908 */909 function test_get_the_date_returns_false_with_null_or_non_existing_post() {910 $this->assertFalse( get_the_date() );911 $this->assertFalse( get_the_date( 'F j, Y h:i:s' ) );912 $this->assertFalse( get_the_date( '', 9 ) );913 $this->assertFalse( get_the_date( 'F j, Y h:i:s', 9 ) );914 }915 916 /**917 * @ticket 28310918 */919 function test_get_the_time_with_id_returns_correct_time() {920 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );921 $this->assertEquals( '16:35:00', get_the_time( 'H:i:s', $post_id ) );922 }923 924 /**925 * @ticket 28310926 */927 function test_get_the_time_returns_false_with_null_or_non_existing_post() {928 $this->assertFalse( get_the_time() );929 $this->assertFalse( get_the_time( 'h:i:s' ) );930 $this->assertFalse( get_the_time( '', 9 ) );931 $this->assertFalse( get_the_time( 'h:i:s', 9 ) );932 }933 934 /**935 * @ticket 28310936 */937 function test_get_post_time_with_id_returns_correct_time() {938 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );939 $this->assertEquals( '16:35:00', get_post_time( 'H:i:s', false, $post_id ) );940 }941 942 /**943 * @ticket 28310944 */945 function test_get_post_time_returns_false_with_null_or_non_existing_post() {946 $this->assertFalse( get_post_time() );947 $this->assertFalse( get_post_time( 'h:i:s' ) );948 $this->assertFalse( get_post_time( '', false, 9 ) );949 $this->assertFalse( get_post_time( 'h:i:s', false, 9 ) );950 }951 952 /**953 * @ticket 28310954 */955 function test_get_post_modified_time_with_id_returns_correct_time() {956 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );957 $this->assertEquals( '16:35:00', get_post_modified_time( 'H:i:s', false, $post_id ) );958 }959 960 /**961 * @ticket 28310962 */963 function test_get_post_modified_time_returns_false_with_null_or_non_existing_post() {964 $this->assertFalse( get_post_modified_time() );965 $this->assertFalse( get_post_modified_time( 'h:i:s' ) );966 $this->assertFalse( get_post_modified_time( '', false, 9 ) );967 $this->assertFalse( get_post_modified_time( 'h:i:s', false, 9 ) );968 }969 970 /**971 * @ticket 28310972 */973 function test_mysql2date_returns_false_with_no_date() {974 $this->assertFalse( mysql2date( 'F j, Y H:i:s', '' ) );975 }976 977 /**978 * @ticket 28310979 */980 function test_mysql2date_returns_gmt_or_unix_timestamp() {981 $this->assertEquals( '441013392', mysql2date( 'G', '1983-12-23 07:43:12' ) );982 $this->assertEquals( '441013392', mysql2date( 'U', '1983-12-23 07:43:12' ) );983 }984 985 /**986 899 * @ticket 25566 987 900 */
Note: See TracChangeset
for help on using the changeset viewer.