Skip to content

Instantly share code, notes, and snippets.

@nb
Created April 22, 2020 12:08
Show Gist options
  • Save nb/69c425d343ef655d75cf75d0b4d2b5d1 to your computer and use it in GitHub Desktop.
Save nb/69c425d343ef655d75cf75d0b4d2b5d1 to your computer and use it in GitHub Desktop.
<?php
class Test_Did_Action extends WP_UnitTestCase {
public function test_did_action_should_be_two_if_action_fired_twice() {
do_action( 'wink' );
do_action( 'wink' );
$this->assertEquals( 2, did_action( 'wink' ) );
}
public function test_did_action_should_be_one_if_action_fired_once() {
do_action( 'wink' );
$this->assertEquals( 1, did_action( 'wink' ) );
}
public function test_did_action_should_be_zero_if_no_action_fired() {
$this->assertEquals( 0, did_action( 'wink' ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment