Make WordPress Core


Ignore:
Timestamp:
10/17/2015 06:02:16 PM (11 years ago)
Author:
wonderboymusic
Message:

Unit Tests: after [35225], make factory a method/getter on WP_UnitTestCase and add magic methods for BC for every plugin that is extending WP_UnitTestCase and accessing the $factory instance prop.

Props nerrad, wonderboymusic.
See #30017, #33968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/query/search.php

    r35225 r35242  
    3232    function test_search_order_title_relevance() {
    3333        foreach ( range( 1, 7 ) as $i )
    34             self::$factory->post->create( array( 'post_content' => $i . rand_str() . ' about', 'post_type' => $this->post_type ) );
    35         $post_id = self::$factory->post->create( array( 'post_title' => 'About', 'post_type' => $this->post_type ) );
     34            self::factory()->post->create( array( 'post_content' => $i . rand_str() . ' about', 'post_type' => $this->post_type ) );
     35        $post_id = self::factory()->post->create( array( 'post_title' => 'About', 'post_type' => $this->post_type ) );
    3636
    3737        $posts = $this->get_search_results( 'About' );
     
    6464     */
    6565    public function test_s_should_exclude_term_prefixed_with_dash() {
    66         $p1 = self::$factory->post->create( array(
     66        $p1 = self::factory()->post->create( array(
    6767            'post_status' => 'publish',
    6868            'post_content' => 'This post has foo but also bar',
    6969        ) );
    70         $p2 = self::$factory->post->create( array(
     70        $p2 = self::factory()->post->create( array(
    7171            'post_status' => 'publish',
    7272            'post_content' => 'This post has only foo',
     
    8585     */
    8686    public function test_s_should_exclude_first_term_if_prefixed_with_dash() {
    87         $p1 = self::$factory->post->create( array(
     87        $p1 = self::factory()->post->create( array(
    8888            'post_status' => 'publish',
    8989            'post_content' => 'This post has foo but also bar',
    9090        ) );
    91         $p2 = self::$factory->post->create( array(
     91        $p2 = self::factory()->post->create( array(
    9292            'post_status' => 'publish',
    9393            'post_content' => 'This post has only bar',
     
    106106     */
    107107    public function test_s_should_not_exclude_for_dashes_in_the_middle_of_words() {
    108         $p1 = self::$factory->post->create( array(
     108        $p1 = self::factory()->post->create( array(
    109109            'post_status' => 'publish',
    110110            'post_content' => 'This post has foo but also bar',
    111111        ) );
    112         $p2 = self::$factory->post->create( array(
     112        $p2 = self::factory()->post->create( array(
    113113            'post_status' => 'publish',
    114114            'post_content' => 'This post has only bar',
    115115        ) );
    116         $p3 = self::$factory->post->create( array(
     116        $p3 = self::factory()->post->create( array(
    117117            'post_status' => 'publish',
    118118            'post_content' => 'This post has only foo-bar',
Note: See TracChangeset for help on using the changeset viewer.