Added new format of hook events.

Fixes #27
This commit is contained in:
Andrey Savchenko committed 2018-12-13 17:24:40 +02:00
1 parent 70de78b276
commit c23531e890
10 files changed
+117 -222

No files matched your search

+3 -20
View File
@@ -1,8 +1,8 @@
<?php
declare( strict_types=1 );
namespace Rarst\Laps\Tests\Record;
use Brain\Monkey\Functions;
use Rarst\Laps\Event\Core_Events;
use Rarst\Laps\Record\Hook_Record_Collector;
use Rarst\Laps\Tests\LapsTestCase;
@@ -18,26 +18,9 @@ class HookTest extends LapsTestCase {
$this->assertTrue( $stopwatch->isStarted( 'Plugins Load' ) );
$this->assertTrue( has_action( 'after_setup_theme', [ $collector, 'after_setup_theme' ] ) );
$this->assertTrue( has_action( 'plugins_loaded', 'function ($input)' ) );
$collector->after_setup_theme();
Functions\expect( 'current_filter' )->once()->andReturn( 'plugins_loaded' );
Functions\expect( 'wp_parse_args' )->once()->andReturnFirstArg();
global $wp_filter;
$wp_hook = $this->getMockBuilder( 'WP_Hook' )
->allowMockingUnknownTypes()
->setMethods( [ 'current_priority' ] )
->getMock();
$wp_hook->method( 'current_priority' )->willReturn( - 2 );
$wp_filter['plugins_loaded'] = $wp_hook;
$collector->tick();
$this->assertFalse( $stopwatch->isStarted( 'Plugins Load' ) );
$stopwatch->start( 'Toolbar' );
$collector->get_records();