Router.php
<?php
namespace Taeluf\ProjectViewer\Test;
class Router extends \Tlf\Tester {
// public function test
public function testThrowWhenDirInvalid(){
}
public function testProjectPermissions(){
}
public function testSetupProject(){
$dir = dirname(__DIR__).'/test-extra/SampleProjects/Taeluf/';
$package = new Mock\Package([
'projects'=>
[
'Taeluf'=>
[
'url'=>'/docs/',
'dir'=>$dir
]
]
]);
$router = new \Taeluf\ProjectViewer\Router($package);
$setup = $router->onRequest_Setup(null, '/docs/Liaison/Events.md');
$active = $router->getActiveProject();
$active->project = $active->project->name;
$active = (array)$active;
$target = (array)[
'project'=>'Liaison',
'branch'=>'version_2',
'request'=>'Events.md',
'mode'=>'docs',
'file'=> $dir.'Liaison/version_2/0-docs/Events.md'
];
$this->compare($target['file'], $active['file']);
$this->compare($target, $active);
}
public function testDir(){
$response = $this->get('/taeluf/provi/temp');
echo $response;
// $this->str_contains(
// $response,
// '<a href="/taeluf/provi-src/">Src Code</a>',
// '<h2>Version 2 Note</h2>',
// '2021 Taeluf, Reed Sutman',
//
// );
}
/**
* @todo this one is working, i think, but i need to actually test it
*/
public function testTemp2(){
$response = $this->get('/taeluf/provi/temp2.md');
echo $response;
// $this->str_contains(
// $response,
// '<a href="/taeluf/provi-src/">Src Code</a>',
// '<h2>Version 2 Note</h2>',
// '2021 Taeluf, Reed Sutman',
//
// );
}
/**
* @test the server is working
* @test a project's main page can be shown
*/
public function testMain(){
$response = $this->get('/taeluf/provi');
echo $response;
$this->str_contains(
$response,
'<a href="/taeluf/provi-src/">Src Code</a>',
'<h2>Version 2 Note</h2>',
'2021 Taeluf, Reed Sutman',
);
}
}