parent
774b367460
commit
79242846b3
@ -1,5 +1,7 @@ |
||||
/src/logs/ |
||||
tts_framework/ |
||||
vendor/ |
||||
/src/tmp/ |
||||
/public/assets/mockup/js/tts.min.js |
||||
/public/assets/mockup/js/tts.min.map |
||||
.phpunit.result.cache |
||||
|
||||
@ -0,0 +1,32 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
namespace UnitTestFiles\Test; |
||||
use PHPUnit\Framework\TestCase; |
||||
|
||||
class FirstTest extends TestCase { |
||||
|
||||
public function setUp(): void { |
||||
require "setup.php"; |
||||
setup("/mockup/app/first/returns_true.html"); |
||||
} |
||||
|
||||
private function do_routes() { |
||||
$found_route = \tts\router::execute(); |
||||
|
||||
if ($found_route) { |
||||
$condition = $found_route; |
||||
} else { |
||||
$app = new \tts\app(); |
||||
$condition = $app->load_controller(); |
||||
} |
||||
return $condition; |
||||
} |
||||
|
||||
public function testTrueAssetsToTrue() { |
||||
$condition = $this->do_routes(); |
||||
$this->assertTrue($condition); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,13 @@ |
||||
<?php |
||||
function setup(string $route) { |
||||
$p_dir = dirname(__DIR__, 2) . "/src/"; |
||||
require_once $p_dir . 'before_main.php'; |
||||
|
||||
\tts\site_helper::set_all_projects(['mockup', 'ex', 'live']); |
||||
\tts\site_helper::set_default_project("mockup"); |
||||
|
||||
$PHPUNIT_Testing = true; |
||||
\tts\site_helper::init(PROJECT_BASE_DIR, $route, "get", $PHPUNIT_Testing); |
||||
|
||||
require_once PROJECT_BASE_DIR . 'main.php'; |
||||
} |
||||
@ -1,4 +1,4 @@ |
||||
#!/usr/bin/php |
||||
#!/usr/bin/env php |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
@ -0,0 +1,5 @@ |
||||
{ |
||||
"require-dev": { |
||||
"phpunit/phpunit": "^9.5" |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,8 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<phpunit bootstrap="vendor/autoload.php" colors="true"> |
||||
<testsuites> |
||||
<testsuite name="Application Test Suite"> |
||||
<directory>UnitTestFiles/Test/</directory> |
||||
</testsuite> |
||||
</testsuites> |
||||
</phpunit> |
||||
@ -0,0 +1,11 @@ |
||||
<?php |
||||
|
||||
namespace prj\mockup\test_controllers\app; |
||||
|
||||
final class first_ctrl { |
||||
|
||||
public function returns_true(): bool { |
||||
return true; |
||||
} |
||||
|
||||
} |
||||
@ -1,52 +1,52 @@ |
||||
<?php
|
||||
declare(strict_types=1); |
||||
|
||||
/* |
||||
* This file is Auto-Generated, Do NOT Modify!!! Please Delete this file to update configuration! |
||||
*/ |
||||
|
||||
/* Contents of : on_html_filter.php */ |
||||
|
||||
\tts\main\registry::get('di')->register('html_filter', function() { |
||||
return new \tts\services\html_filter(); |
||||
}); |
||||
/* Contents of : on_log.php */ |
||||
|
||||
\tts\main\registry::get('di')->register('log', function(array $arg) { |
||||
$file_name = null; |
||||
if (isset($arg[0]) && is_string($arg[0])) { |
||||
$file_name = $arg[0]; // filename |
||||
} |
||||
|
||||
if (isset($arg[1]) && is_int($arg[1])) { |
||||
$count = $arg[1]; // max count |
||||
return new \tts\services\log($file_name, $count); |
||||
} |
||||
|
||||
if (! empty($file_name)) { |
||||
return new \tts\services\log($file_name); |
||||
} |
||||
|
||||
return new \tts\services\log(); |
||||
}); |
||||
/* Contents of : on_templates.php */ |
||||
|
||||
\tts\main\registry::get('di')->register('templates', function(array $arg) { |
||||
$file_type = '.tpl'; |
||||
if (isset($arg[0]) && is_string($arg[0])) { |
||||
$file_type = $arg[0]; |
||||
} |
||||
return new \tts\services\liquid_templates($file_type); |
||||
}); |
||||
/* Contents of : on_test_db.php */ |
||||
|
||||
\tts\main\registry::get('di')->register('db_mocker', function($args) { |
||||
try { |
||||
$conn = new \PDO('sqlite::memory:'); |
||||
// set the PDO error mode to exception |
||||
$conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); |
||||
return $conn; |
||||
} catch (\PDOException $e) { |
||||
\tts\exceptions\DB_Exception::customMessage($e); |
||||
} |
||||
|
||||
/* |
||||
* This file is Auto-Generated, Do NOT Modify!!! Please Delete this file to update configuration! |
||||
*/ |
||||
|
||||
/* Contents of : on_html_filter.php */ |
||||
|
||||
\tts\main\registry::get('di')->register('html_filter', function() { |
||||
return new \tts\services\html_filter(); |
||||
}); |
||||
/* Contents of : on_log.php */ |
||||
|
||||
\tts\main\registry::get('di')->register('log', function(array $arg) { |
||||
$file_name = null; |
||||
if (isset($arg[0]) && is_string($arg[0])) { |
||||
$file_name = $arg[0]; // filename |
||||
} |
||||
|
||||
if (isset($arg[1]) && is_int($arg[1])) { |
||||
$count = $arg[1]; // max count |
||||
return new \tts\services\log($file_name, $count); |
||||
} |
||||
|
||||
if (! empty($file_name)) { |
||||
return new \tts\services\log($file_name); |
||||
} |
||||
|
||||
return new \tts\services\log(); |
||||
}); |
||||
/* Contents of : on_templates.php */ |
||||
|
||||
\tts\main\registry::get('di')->register('templates', function(array $arg) { |
||||
$file_type = '.tpl'; |
||||
if (isset($arg[0]) && is_string($arg[0])) { |
||||
$file_type = $arg[0]; |
||||
} |
||||
return new \tts\services\liquid_templates($file_type); |
||||
}); |
||||
/* Contents of : on_test_db.php */ |
||||
|
||||
\tts\main\registry::get('di')->register('db_mocker', function($args) { |
||||
try { |
||||
$conn = new \PDO('sqlite::memory:'); |
||||
// set the PDO error mode to exception |
||||
$conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); |
||||
return $conn; |
||||
} catch (\PDOException $e) { |
||||
\tts\exceptions\DB_Exception::customMessage($e); |
||||
} |
||||
}); |
||||
Loading…
Reference in new issue