# mlsimport/6.0.7/tests/LoaderTest.php

MLSImport: IDX Plugin &amp; MLS Plugin for Real Estate Listings, version 6.0.7. 33 lines.

- Page: https://pluginprobe.com/plugins/mlsimport/6.0.7/code/tests/LoaderTest.php
- Raw: https://pluginprobe.com/plugins/mlsimport/6.0.7/raw/tests/LoaderTest.php
- Modified: 2025-06-09T07:19:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/mlsimport/6.0.7/code/tests/LoaderTest.php#L10-L20`.

```php
<?php
use PHPUnit\Framework\TestCase;

class LoaderTest extends TestCase {
    private function getPrivate( $object, $property ) {
        $ref = new ReflectionClass( $object );
        $prop = $ref->getProperty( $property );
        $prop->setAccessible( true );
        return $prop->getValue( $object );
    }

    public function test_add_action_stores_hook() {
        $loader = new Mlsimport_Loader();
        $loader->add_action( 'init', new stdClass(), 'method' );
        $actions = $this->getPrivate( $loader, 'actions' );
        $this->assertCount( 1, $actions );
        $this->assertEquals( 'init', $actions[0]['hook'] );
    }

    public function test_run_executes_registered_hooks() {
        global $actions_called, $filters_called;
        $actions_called = [];
        $filters_called = [];
        $loader = new Mlsimport_Loader();
        $component = new stdClass();
        $loader->add_action( 'action_hook', $component, 'callback' );
        $loader->add_filter( 'filter_hook', $component, 'callback2' );
        $loader->run();
        $this->assertEquals( 'action_hook', $actions_called[0][0] );
        $this->assertEquals( 'filter_hook', $filters_called[0][0] );
    }
}

```
