Event.php

<?php

namespace Liaison\Test\Compo\Event;

class Event extends \Taeluf\Tester {
    
    public function testDerived(){
        $lia = new \Liaison(['bare'=>true]);
        $package = new \Liaison\Test\Mock\Package($lia);
        $event = new \Lia\Compo\Event($package);
        $tester = new TestEventRunner($package);
        $package->onPackageReady();
        $package->scanForPrefixesInCompos();
        $event->emit('AllPackagesReady');
        // $tester->onReady();
        // $tester->onEmitAllPackagesReady();
        
        ob_start();
        $test1 = 'We need a new justice system.';
        $lia->emit('Test.eventTestStarted', $test1);
        $a1 = ob_get_clean();
        
        
        
        $test3 = 'User privacy should always be a priority.';
        $lia->schedule('Test.eventMidWithMultiple', function($phrase){echo $phrase;});
        $lia->api('lia:event.schedule', 'Test.eventMidWithMultiple', function($phrase){echo $phrase;});
        ob_start();
        $lia->emit('Test.eventMidWithMultiple', $test3);
        $test3 = $test3.$test3;
        $a3 = ob_get_clean();
        
        ob_start();
        $test2 = 'Poor people suffer in our current society, even if they work hard.';
        // $lia->emit('Test.eventTestFinishing', $test2);
        $lia->api('lia:event.emit','Test.eventTestFinishing', $test2);
        $a2 = ob_get_clean();
        
        return true
            && $this->compare($test1, $a1)
            && $this->compare($test2, $a2)
            && $this->compare($test3, $a3)
        ;
    }
}

Event::runAll();

class TestEventRunner extends \Lia\Compo {

    public function onEmit_Test_eventTestStarted($phrase){
        echo $phrase;
    }
    
    public function onEmitTest_eventTestFinishing($phrase){
        echo $phrase;
    }
}