Make WordPress Core

Changeset 57703

Timestamp:
02/23/2024 04:53:39 PM (9 months ago)
Author:
joemcgill
Message:

Editor: Improve PHPUnit tests for block pattern registration.

This is a followup to [57683], which adds additional unit test coverage to ensure block pattern content is not loaded from files during registration, but instead when those patterns are accessed. This also improves the set_up and tear_down methods for the Tests_Blocks_wpBlockPattersRegistry test class to ensure that any modifications made to registered blocks during the tests are reset after each test.

Props thekt12, joemcgill.
See #59532.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/blocks/wpBlockPatternsRegistry.php

    r57627 r57703  
    2222
    2323    /**
     24
     25
     26
     27
     28
     29
     30
     31
     32
    2433     * Set up each test method.
    2534     *
     
    2938        parent::set_up();
    3039
    31         $this->registry = new WP_Block_Patterns_Registry();
     40        $this->registry                     = new WP_Block_Patterns_Registry();
     41        $this->original_registered_patterns = $this->get_registered_patterns_variable_value();
    3242    }
    3343
     
    4656        }
    4757
     58
    4859        parent::tear_down();
    4960    }
     
    544555        $this->assertEmpty( array_intersect( $theme_patterns, $registered ), 'Theme patterns were were incorrectly registered.' );
    545556    }
     557
     558
     559
     560
     561
     562
     563
     564
     565
     566
     567
     568
     569
     570
     571
     572
     573
     574
     575
     576
     577
     578
     579
     580
     581
     582
     583
     584
     585
     586
     587
     588
     589
     590
     591
     592
     593
     594
     595
     596
     597
     598
     599
     600
     601
     602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
     625
     626
     627
     628
     629
     630
     631
     632
     633
     634
     635
     636
     637
     638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
     669
     670
     671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
     689
     690
     691
    546692}
Note: See TracChangeset for help on using the changeset viewer.