PHP code example of wp-launchpad / phpunit-wp-hooks

1. Go to this page and download the library: Download wp-launchpad/phpunit-wp-hooks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wp-launchpad / phpunit-wp-hooks example snippets


    protected function setUp(): void
    {
        parent::setUp();
        $this->mockHooks();
    }

    protected function tearDown(): void
    {
        $this->resetHooks();
        parent::tearDown();
    }


     protected function getPrefix(): string {
        return 'my_prefix';
     }

     protected function getCurrentTest(): string {
        return $this->getName();
     }

public function myCallback() {
    return false;
}

/** 
 * @hook my-event 15
 */ 

/**
 * @hook-isolated my-event myCallback 15
 */