Elgg\Mail\MailerTest::testElggSendEmailUsesHook PHP Method

testElggSendEmailUsesHook() public method

    function testElggSendEmailUsesHook()
    {
        _elgg_services()->hooks->registerHandler('email', 'system', [$this, 'handleEmailHook1']);
        elgg_send_email("[email protected]", "[email protected]", "Hello", "World", ['foo' => 1]);
        _elgg_services()->hooks->unregisterHandler('email', 'system', [$this, 'handleEmailHook1']);
        $expected_data = ['to' => "[email protected]", 'from' => "[email protected]", 'subject' => "Hello", 'body' => "World", 'headers' => ["Content-Type" => "text/plain; charset=UTF-8; format=flowed", "MIME-Version" => "1.0", "Content-Transfer-Encoding" => "8bit"], 'params' => ['foo' => 1]];
        $this->assertEquals($expected_data, $this->hookArgs[0][2]);
        $this->assertEquals($expected_data, $this->hookArgs[0][3]);
        $message = $this->mailer->getLastMessage();
        $this->assertEquals("<Hello>", $message->getBodyText());
    }