Changeset 56771 for trunk/tests/phpunit/tests/blocks/wpGetBlockPatterns.php
- Timestamp:
- 10/03/2023 06:17:03 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/wpGetBlockPatterns.php
r56765 r56771 32 32 $theme = wp_get_theme( 'block-theme-patterns' ); 33 33 _wp_get_block_patterns( $theme ); 34 $transient = get_transient( 'wp_theme_patterns_block-theme-patterns' );35 34 $this->assertSameSets( 36 35 array( 37 'version' => '1.0.0', 38 'patterns' => array( 39 'cta.php' => array( 40 'title' => 'Centered Call To Action', 41 'slug' => 'block-theme-patterns/cta', 42 'description' => '', 43 'categories' => array( 'call-to-action' ), 44 ), 36 'cta.php' => array( 37 'title' => 'Centered Call To Action', 38 'slug' => 'block-theme-patterns/cta', 39 'description' => '', 40 'categories' => array( 'call-to-action' ), 45 41 ), 46 42 ), 47 $t ransient,43 $theme->get_pattern_cache(), 48 44 'The transient for block theme patterns should be set' 49 45 ); 50 $theme->cache_delete(); 51 $transient = get_transient( 'wp_theme_patterns_block-theme-patterns' ); 46 $theme->delete_pattern_cache(); 52 47 $this->assertFalse( 53 $t ransient,48 $theme->get_pattern_cache(), 54 49 'The transient for block theme patterns should have been cleared' 55 50 ); … … 61 56 public function test_should_clear_transient_after_switching_theme() { 62 57 switch_theme( 'block-theme' ); 63 _wp_get_block_patterns( wp_get_theme() ); 58 $theme1 = wp_get_theme(); 59 _wp_get_block_patterns( $theme1 ); 64 60 $this->assertSameSets( 65 array( 66 'version' => '1.0.0', 67 'patterns' => array(), 68 ), 69 get_transient( 'wp_theme_patterns_block-theme' ), 61 array(), 62 $theme1->get_pattern_cache(), 70 63 'The transient for block theme should be set' 71 64 ); 72 65 switch_theme( 'block-theme-patterns' ); 73 $this->assertFalse( get_transient( 'wp_theme_patterns_block-theme'), 'Transient should not be set for block theme after switch theme' );74 $th is->assertFalse( get_transient( 'wp_theme_patterns_block-theme-patterns' ), 'Transient should not be set for block theme patterns before being requested');75 _wp_get_block_patterns( wp_get_theme());76 $transient = get_transient( 'wp_theme_patterns_block-theme-patterns');66 $this->assertFalse( $theme1->get_pattern_cache(), 'Transient should not be set for block theme after switch theme' ); 67 $theme2 = wp_get_theme(); 68 $this->assertFalse( $theme2->get_pattern_cache(), 'Transient should not be set for block theme patterns before being requested' ); 69 _wp_get_block_patterns( $theme2 ); 77 70 $this->assertSameSets( 78 71 array( 79 'version' => '1.0.0', 80 'patterns' => array( 81 'cta.php' => array( 82 'title' => 'Centered Call To Action', 83 'slug' => 'block-theme-patterns/cta', 84 'description' => '', 85 'categories' => array( 'call-to-action' ), 86 ), 72 'cta.php' => array( 73 'title' => 'Centered Call To Action', 74 'slug' => 'block-theme-patterns/cta', 75 'description' => '', 76 'categories' => array( 'call-to-action' ), 87 77 ), 78 88 79 ), 89 $t ransient,80 $theme2->get_pattern_cache(), 90 81 'The transient for block theme patterns should be set' 91 82 ); … … 101 92 array( 102 93 'theme' => 'block-theme', 103 'patterns' => array( 104 'version' => '1.0.0', 105 'patterns' => array(), 106 ), 94 'patterns' => array(), 107 95 ), 108 96 array( 109 97 'theme' => 'block-theme-child', 110 'patterns' => array( 111 'version' => '1.0.0', 112 'patterns' => array(), 113 ), 98 'patterns' => array(), 114 99 ), 115 100 array( 116 101 'theme' => 'block-theme-patterns', 117 102 'patterns' => array( 118 'version' => '1.0.0', 119 'patterns' => array( 120 'cta.php' => array( 121 'title' => 'Centered Call To Action', 122 'slug' => 'block-theme-patterns/cta', 123 'description' => '', 124 'categories' => array( 'call-to-action' ), 125 ), 103 'cta.php' => array( 104 'title' => 'Centered Call To Action', 105 'slug' => 'block-theme-patterns/cta', 106 'description' => '', 107 'categories' => array( 'call-to-action' ), 126 108 ), 127 109 ), … … 129 111 array( 130 112 'theme' => 'broken-theme', 131 'patterns' => array( 132 'version' => false, 133 'patterns' => array(), 134 ), 113 'patterns' => array(), 135 114 ), 136 115 array( 137 116 'theme' => 'invalid', 138 'patterns' => array( 139 'version' => false, 140 'patterns' => array(), 141 ), 117 'patterns' => array(), 142 118 ), 143 119 );
Note: See TracChangeset
for help on using the changeset viewer.