Make WordPress Core

Ticket #22746: meta-unit-test.diff

File meta-unit-test.diff, 898 bytes (added by xknown, 10 years ago)

Add two more assertions to the test_metadata_exists() test method.

  • tests/phpunit/tests/meta.php

     
    8181                $this->assertTrue( metadata_exists( 'user',  $this->author->ID, 'meta_key' ) );
    8282                $this->assertFalse( metadata_exists( 'user',  1234567890, 'foobarbaz' ) );
    8383                $this->assertFalse( metadata_exists( 'user',  1234567890, 'meta_key' ) );
    84         }
    8584
     85        // Let's see if it returns the correct value when adding a filter.
     86        add_filter( 'get_user_metadata', '__return_zero' );
     87        $this->assertFalse( metadata_exists( 'user', $this->author->ID, 'meta_key' ) ); // existing meta key
     88        $this->assertFalse( metadata_exists( 'user', 1234567890, 'meta_key' ) );
     89        remove_filter( 'get_user_metadata', '__return_zero' );
     90    }
     91
    8692        /**
    8793         * @ticket 18158
    8894         */