<?php
/**
*
* The callable views defined here were purely made for testing the Scrawl extension. They do not have any associated unit tests.
*/
namespace Lia\Test;
if (!$this instanceof \Lia\Package){
//phptest server runs this bootstrap file, but this bootstrap file is for the liaison package, not the test server.
return;
}
/** @var \Lia\Package $package */
$package = $this;
$lia = $package->lia;
/** @var \Lia\Addon\View $v */
$v = \Lia\Addon\View::from($lia);
\Lia\Addon\View::from($lia)
->addViewCallable($package->name.':anonymous_function',
function(string $view_name, array $args): string{
return "Sample anonymous function callable view";
}
);
function sample_view_function(string $view_name, array $args){
return "Sample global function callable view";
}
\Lia\Addon\View::from($lia)
->addViewCallable($package->name.':string_callable','Lia\\Test\\sample_view_function');
class SampleViewClass {
public function sample_view_method(string $view_name, array $args){
return "Sample object method callable view";
}
}
\Lia\Addon\View::from($lia)
->addViewCallable($package->name.':object_method_array',[new SampleViewClass(), 'sample_view_method']);
$v->addViewFile($package->name.':file_file', __DIR__.'/view/theme.php');
/** @var \Lia\Addon\Router $r */
$r = \Lia\Addon\Router::from($lia);
$r->addRoute('@POST./test-post/', function(){}, null);
$r->addRoute('@GET.@POST./test-get-post/', function(){}, null);
$r->addRoute('/doc-dupes/', __DIR__.'/public/add-resource-file.php', null);
$r->addRoute('/doc-dupes/', __DIR__.'/public/add-css-and-js.php', null);
$r->addRoute('/doc-dupes/', __DIR__.'/public/nest-res.php', null);