<?php
namespace Lia\Test;
/**
* Tests that are cleanly written & easy to follow.
*
* They are tests in order to be verifiable - not in order to actually test features.
*
* Those tests go elsewhere, then simpler, cleaner versions go here.
*/
class Documentation extends \Tlf\Tester {
public function testOverwriteView(){
$lia = new \Lia();
$server = new \Lia\Package\Server($lia);
$view_addon = $server->addons['view'];
//remove all server views, if you want
$view_addon->views['server'] = [];
//add a new server view
$lia->addViewCallable('server:theme', function(){return "abc";});
// you can ovewrite without first emptying the server views
//another option is to ovewrite this way:
// $view_addon->views['server']['theme'] = $view_addon->views['mysite']['theme'];
$this->compare('abc', $lia->view('theme'));
$this->compare('abc', $lia->view('server:theme'));
$this->compare('abc', $lia->view(':theme'));
}
public function testAddonStructure(){
$lia = new \Lia();
$server = new \Lia\Package\Server($lia);
$addons = [
'autoload'=> $server->addons['autoload'],
'cache'=> $server->addons['cache'],
'error'=> $server->addons['error'],
'hook'=> $server->addons['hook'],
'redirect'=>$server->addons['redirect'],
'resourcesorter'=> $server->addons['resourcesorter'],
'resources'=> $server->addons['resources'],
'router'=> $server->addons['router'],
'seo'=> $server->addons['seo'],
'server'=> $server->addons['server'],
'view'=> $server->addons['view'],
];
$router = $lia->addons['router'];
$this->compare($server->addons['router'],$router);
$this->compare_arrays($addons, $lia->addons);
}
}