PluginProbe
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings / 6.0.7
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings v6.0.7
7.2 7.1.2 7.1.1 7.1 7.0.4 7.0.6 7.0.7 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 6.3.1 trunk 5.7.3 5.7.5 5.8.1 5.8.2 5.8.3 5.8.4 5.8.6 6.0.4 6.0.5 6.0.7 All 35 releases
mlsimport / tests / LoaderTest.php

LoaderTest.php in MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings 6.0.7, at tests/LoaderTest.php

33 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 use PHPUnit\Framework\TestCase;
3
4 class LoaderTest extends TestCase {
5 private function getPrivate( $object, $property ) {
6 $ref = new ReflectionClass( $object );
7 $prop = $ref->getProperty( $property );
8 $prop->setAccessible( true );
9 return $prop->getValue( $object );
10 }
11
12 public function test_add_action_stores_hook() {
13 $loader = new Mlsimport_Loader();
14 $loader->add_action( 'init', new stdClass(), 'method' );
15 $actions = $this->getPrivate( $loader, 'actions' );
16 $this->assertCount( 1, $actions );
17 $this->assertEquals( 'init', $actions[0]['hook'] );
18 }
19
20 public function test_run_executes_registered_hooks() {
21 global $actions_called, $filters_called;
22 $actions_called = [];
23 $filters_called = [];
24 $loader = new Mlsimport_Loader();
25 $component = new stdClass();
26 $loader->add_action( 'action_hook', $component, 'callback' );
27 $loader->add_filter( 'filter_hook', $component, 'callback2' );
28 $loader->run();
29 $this->assertEquals( 'action_hook', $actions_called[0][0] );
30 $this->assertEquals( 'filter_hook', $filters_called[0][0] );
31 }
32 }
33