94 lines
2.3 KiB
PHP
94 lines
2.3 KiB
PHP
<?php
|
|
|
|
echo "Проверка файлов базы данных:\n";
|
|
|
|
$dbConfigPath = __DIR__ . '/../config/database.php';
|
|
$test->assert(file_exists($dbConfigPath), "Файл config/database.php существует");
|
|
|
|
$dbConfigContent = file_get_contents($dbConfigPath);
|
|
|
|
$test->assertContains(
|
|
"pgsql",
|
|
$dbConfigContent,
|
|
"Используется драйвер PostgreSQL"
|
|
);
|
|
|
|
$dbCorePath = __DIR__ . '/../app/Core/Database.php';
|
|
$test->assert(file_exists($dbCorePath), "Файл app/Core/Database.php существует");
|
|
|
|
$dbCoreContent = file_get_contents($dbCorePath);
|
|
|
|
$test->assertContains(
|
|
"class Database",
|
|
$dbCoreContent,
|
|
"Класс Database определён"
|
|
);
|
|
|
|
$test->assertContains(
|
|
"getInstance",
|
|
$dbCoreContent,
|
|
"Метод getInstance существует"
|
|
);
|
|
|
|
$test->assertContains(
|
|
"getConnection",
|
|
$dbCoreContent,
|
|
"Метод getConnection существует"
|
|
);
|
|
|
|
echo "\nПроверка модели User:\n";
|
|
|
|
$userModelPath = __DIR__ . '/../app/Models/User.php';
|
|
$test->assert(file_exists($userModelPath), "Файл модели User существует");
|
|
|
|
$userModelContent = file_get_contents($userModelPath);
|
|
|
|
$test->assertContains(
|
|
"extends Model",
|
|
$userModelContent,
|
|
"User наследует Model"
|
|
);
|
|
|
|
$test->assertContains(
|
|
"protected string \$table = 'users'",
|
|
$userModelContent,
|
|
"User использует таблицу 'users'"
|
|
);
|
|
|
|
$test->assertContains(
|
|
"protected string \$primaryKey = 'user_id'",
|
|
$userModelContent,
|
|
"User использует первичный ключ 'user_id'"
|
|
);
|
|
|
|
echo "\nПроверка базовой модели:\n";
|
|
|
|
$modelPath = __DIR__ . '/../app/Core/Model.php';
|
|
$test->assert(file_exists($modelPath), "Файл Core/Model.php существует");
|
|
|
|
$modelContent = file_get_contents($modelPath);
|
|
|
|
$test->assertContains(
|
|
"public function create(array \$data)",
|
|
$modelContent,
|
|
"Метод create существует"
|
|
);
|
|
|
|
$test->assertContains(
|
|
"public function update(int \$id, array \$data)",
|
|
$modelContent,
|
|
"Метод update существует"
|
|
);
|
|
|
|
$test->assertContains(
|
|
"public function delete(int \$id)",
|
|
$modelContent,
|
|
"Метод delete существует"
|
|
);
|
|
|
|
$test->assertContains(
|
|
"public function find(int \$id)",
|
|
$modelContent,
|
|
"Метод find существует"
|
|
);
|