diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml index e465cd8..3d9aab3 100644 --- a/.github/workflows/test-php.yml +++ b/.github/workflows/test-php.yml @@ -34,7 +34,7 @@ jobs: run: composer run lint phpunit: name: Phpunit - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 services: mysql: image: mysql:5.7 diff --git a/inc/Block_Patterns.php b/inc/Block_Patterns.php index eee331c..b3a2b0a 100644 --- a/inc/Block_Patterns.php +++ b/inc/Block_Patterns.php @@ -37,7 +37,6 @@ class Block_Patterns { * Block_Patterns constructor. */ public function __construct() { - $this->setup_properties(); add_action( 'init', array( $this, 'run' ) ); } @@ -48,6 +47,7 @@ public function __construct() { * @return void */ public function run() { + $this->setup_properties(); $this->register_categories(); $this->register_patterns(); } diff --git a/inc/Block_Styles.php b/inc/Block_Styles.php index 5bd8ad8..081cfb8 100644 --- a/inc/Block_Styles.php +++ b/inc/Block_Styles.php @@ -26,6 +26,26 @@ class Block_Styles { * Block Styles constructor. */ public function __construct() { + + add_action( 'init', array( $this, 'run' ) ); + } + + /** + * Run the class functionality. + * + * @return void + */ + public function run() { + $this->setup_properties(); + $this->add_block_styles(); + } + + /** + * Setup class properties. + * + * @return void + */ + private function setup_properties() { $this->styles = array( 'core/categories' => array( array( @@ -34,9 +54,6 @@ public function __construct() { ), ), ); - - add_action( 'init', array( $this, 'add_block_styles' ) ); - } /**