Main.php

<?php

namespace Tlf\Tester\Test;

class Main extends \Tlf\Tester {

    /**
     * @test that seo meta info is added from the html
     */
    public function testMain(){
        $_SERVER['HTTP_HOST'] = 'test.com';
        $lia = new \Lia();
        $server = new \Lia\Package\Server($lia);
        \Lia\Addon\SeoExtractor::enable($lia);
        $lia->addRoute('/',function($request, $response){
            $response->content = 
            <<<HTML
            <h1>Title1</h1>
            <p>Description1</p>
            <img src="/img1.png" alt="image" />
            HTML;
        });

        $response = $lia->addon('lia:server.server')->getResponse('/','GET');
        echo $response->content;

        $this->str_contains($response->content,
            [
                '<title>Title1</title>',
                '<meta property="og:title" content="Title1" />',
                '<meta name="description" content="Description1" />',
                '<meta property="og:description" content="Description1" />',
                '<meta property="og:type" content="summary" />',
                '<meta property="twitter:card" content="summary" />',
                '<meta property="og:image" content="image" />',
                '<meta property="twitter:image" content="http://test.com/img1.png" />',
                '<meta property="og:image:alt" content="image" />',
            ]
        );
    }
}