Make WordPress Core


Ignore:
Timestamp:
09/06/2022 10:09:49 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use the factory method instead of the property.

This replaces all references to the WP_UnitTestCase_Base::$factory property with static function calls to the WP_UnitTestCase_Base::factory() method.

This is a consistency improvement for the test suite.

Follow up to [35225], [35242], [49603], [54087], [54088].

Props jrf.
See #55652.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/general/template.php

    r54088 r54090  
    105105     */
    106106    public function test_has_site_icon_returns_true_when_called_for_other_site_with_site_icon_set() {
    107         $blog_id = $this->factory->blog->create();
     107        $blog_id = self::factory()->blog->create();
    108108        switch_to_blog( $blog_id );
    109109        $this->set_site_icon();
     
    120120     */
    121121    public function test_has_site_icon_returns_false_when_called_for_other_site_without_site_icon_set() {
    122         $blog_id = $this->factory->blog->create();
     122        $blog_id = self::factory()->blog->create();
    123123
    124124        $this->assertFalse( has_site_icon( $blog_id ) );
     
    299299     */
    300300    public function test_has_custom_logo_returns_true_when_called_for_other_site_with_custom_logo_set() {
    301         $blog_id = $this->factory->blog->create();
     301        $blog_id = self::factory()->blog->create();
    302302        switch_to_blog( $blog_id );
    303303        $this->set_custom_logo();
     
    314314     */
    315315    public function test_has_custom_logo_returns_false_when_called_for_other_site_without_custom_logo_set() {
    316         $blog_id = $this->factory->blog->create();
     316        $blog_id = self::factory()->blog->create();
    317317
    318318        $this->assertFalse( has_custom_logo( $blog_id ) );
     
    344344     */
    345345    public function test_get_custom_logo_returns_logo_when_called_for_other_site_with_custom_logo_set() {
    346         $blog_id = $this->factory->blog->create();
     346        $blog_id = self::factory()->blog->create();
    347347        switch_to_blog( $blog_id );
    348348
     
    467467     */
    468468    public function test_get_site_icon_url_preserves_switched_state() {
    469         $blog_id = $this->factory->blog->create();
     469        $blog_id = self::factory()->blog->create();
    470470        switch_to_blog( $blog_id );
    471471
     
    487487     */
    488488    public function test_has_custom_logo_preserves_switched_state() {
    489         $blog_id = $this->factory->blog->create();
     489        $blog_id = self::factory()->blog->create();
    490490        switch_to_blog( $blog_id );
    491491
     
    507507     */
    508508    public function test_get_custom_logo_preserves_switched_state() {
    509         $blog_id = $this->factory->blog->create();
     509        $blog_id = self::factory()->blog->create();
    510510        switch_to_blog( $blog_id );
    511511
Note: See TracChangeset for help on using the changeset viewer.