Make WordPress Core

Changeset 26 in tests for wp-testcase/test_actions.php


Ignore:
Timestamp:
09/23/2007 10:46:47 PM (19 years ago)
Author:
tellyworth
Message:

add test for did_action()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_actions.php

    r25 r26  
    101101        }
    102102
     103        function test_did_action() {
     104                $tag1 = rand_str();
     105                $tag2 = rand_str();
     106               
     107                // do action tag1 but not tag2
     108                do_action($tag1);
     109                $this->assertEquals(1, did_action($tag1));
     110                $this->assertEquals(0, did_action($tag2));
     111
     112                // do action tag2 a random number of times
     113                $count = rand(0, 10);
     114                for ($i=0; $i<$count; $i++)
     115                        do_action($tag2);
     116
     117                // tag1's count hasn't changed, tag2 should be correct
     118                $this->assertEquals(1, did_action($tag1));
     119                $this->assertEquals($count, did_action($tag2));
     120
     121        }
    103122}
    104123
Note: See TracChangeset for help on using the changeset viewer.