Changeset 53861 for trunk/tests/phpunit/tests/query.php
- Timestamp:
- 08/08/2022 02:38:08 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query.php
r53857 r53861 2 2 3 3 class Tests_Query extends WP_UnitTestCase { 4 5 /**6 * Fixed date post ID.7 *8 * @var int9 */10 public static $post_with_date;11 4 12 5 public function set_up() { … … 15 8 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 16 9 create_initial_taxonomies(); 17 }18 19 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {20 self::$post_with_date = $factory->post->create(21 array(22 'post_date' => '2020-01-05 12:00:00',23 'post_name' => 'post-with-date',24 )25 );26 10 } 27 11 … … 715 699 716 700 /** 717 * @ticket 52252718 * @dataProvider data_malformed_date_queries719 *720 * @param string $permalink_structure Permalink structure.721 * @param array $query_vars Querystring parameteres.722 */723 public function test_malformed_date_queries( $permalink_structure, $query_vars ) {724 $this->set_permalink_structure( $permalink_structure );725 $this->go_to( add_query_arg( $query_vars, home_url() ) );726 727 /*728 * Ticket 52252 was to prevent notices from being thrown729 * if the date query is malformed.730 *731 * The test will automatically fail if the function triggers a notice,732 * so this dummy assertion is just for accurate stats.733 */734 $this->assertTrue( true );735 }736 737 /**738 * Data provider for test_malformed_date_queries.739 *740 * @return array Test data.741 */742 public function data_malformed_date_queries() {743 return array(744 '/%postname%/ with missing year' => array(745 '/%postname%/',746 array(747 'monthnum' => 1,748 'day' => 15,749 ),750 ),751 '/%postname%/ with month only' => array(752 '/%postname%/',753 array(754 'monthnum' => 1,755 ),756 ),757 '/%year%/%postname%/ with missing month' => array(758 '/%year%/%postname%/',759 array(760 'year' => 2020,761 'day' => 15,762 ),763 ),764 );765 }766 767 /**768 701 * @ticket 55100 769 702 */
Note: See TracChangeset
for help on using the changeset viewer.