Seo.php

<?php

namespace Liaison\Test;

class Seo extends \Taeluf\Tester {


    public function testSeoFunctions(){
        // set title
        // set image
        // set description
        // og:image & twitter: stuffs
        // $lia = new \Liaison(['bare'=>true]);
        // $package = new \Liaison\Test\Mock\Package($lia);
        // $config = new \Lia\Compo\Config($package);
        // $cache = new \Lia\Compo\Cache($package);
        // $lia->set('lia:cache.dir', $this->cacheDir);
        // $res = new \Lia\Compo\Resources($package);
        // $seo = new \Lia\Compo\Seo($package);
        $lia = new \Liaison();

        //@export_start(Usage.Seo)
        $lia->seoTitle('Test Page');
        $lia->seoDescription('Test description');
        $lia->seoImage('/path/to/image.jpg', 'alt text for image');
        $lia->seoUrl('/canonical/url/');
        $lia->seoSiteName('Liaison test');
        $html = $lia->getHeadHtml(); //includes script & stylesheet tags
        //You can alternatively use $lia->getSeoHtml(); 
        //@export_end(Usage.Seo)

        $aHtml = trim($html);
        //var_dump($aHtml);
        // if implmentation changes, just uncomment the var_dump, visually verify, then copy+paste into the HEREDOC 
        $tHtml = 
        <<<HTML
        //@export_start(Usage.Seo.Output)
            <title>Test Page</title>
            <meta property="og:title" content="Test Page" />
            
            <meta name="description" content="Test description" />
            <meta property="og:description" content="Test description" />
            
            <meta property="og:image" content="/path/to/image.jpg" />
            
            <meta property="og:image:alt" content="alt text for image" />
            
            <link rel="canonical" href="/canonical/url/" />
            <meta name="og:url" content="/canonical/url/" />
            
            <meta name="og:site_name" content="Liaison test" />
        //@export_end(Usage.Seo.Output)
        HTML;
        $tHtml = explode("\n",$tHtml);
        array_pop($tHtml);
        array_shift($tHtml);
        $tHtml = trim(implode("\n",$tHtml));
        
        $this->compare($tHtml, $aHtml);

    }

}