jikan-rest/bootstrap/tests.php
pushrbx a530e9f5d6 multiple changes
- wip -> http tests should use model factories
- test runner bootstrap: jikan models are cached in a temporary file
- fixed various bugs
- improved test execution time with typesense
- added new dev dependency: ClassFinder
- updated composer scripts to include coverage generation
- added coverage reports in phpunit
- improved roadrunner integration
- updated docker image
  - added xdebug in disabled state
2023-05-21 11:18:02 +01:00

23 lines
661 B
PHP

<?php
use App\JikanApiModel;
use PackageVersions\Versions;
use HaydenPierce\ClassFinder\ClassFinder;
require_once __DIR__.'/../vendor/autoload.php';
/*
Defines
*/
defined('JIKAN_PARSER_VERSION') or define('JIKAN_PARSER_VERSION', Versions::getVersion('jikan-me/jikan'));
$classNamesCachePath = __DIR__ . "/../storage/app";
// this line only works if dev dependencies are installed
$classes = ClassFinder::getClassesInNamespace("App");
$jikanModels = array_values(
array_filter($classes, fn($class) => is_subclass_of($class, JikanApiModel::class))
);
file_put_contents($classNamesCachePath . "/jikan_model_classes.json", json_encode($jikanModels));