Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
martynmjones committed Sep 3, 2024
1 parent f12ac73 commit 0baf754
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/Unit/Assets/ScriptAssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,19 @@ public function test_can_enqueue() {
$asset = new ScriptAsset( __FUNCTION__, self::URI, [], '' );
$this->assertTrue( $asset->can_enqueue() );
}

/**
* Confirm an exception is logged using the `woocommerce_gla_exception`
* action if an asset is enqueued before it is registered.
*
* @return void
*/
public function test_exception_logged_if_asset_enqueued_before_registration() {
do_action( 'wp_enqueue_scripts' );

$asset = new ScriptAsset( __FUNCTION__, self::URI, [], '', '__return_true' );
$asset->enqueue();

$this->assertEquals( 1, did_action( 'woocommerce_gla_exception' ) );
}
}

0 comments on commit 0baf754

Please sign in to comment.