Reorganizes tests folder structure
parent
5327bde032
commit
f0b487ca36
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/database.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/database.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/ratelimiter.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/ratelimiter.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/includes/rate_limit_middleware.php';
|
require_once dirname(__DIR__, 3) . '/app/includes/rate_limit_middleware.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/includes/session_middleware.php';
|
require_once dirname(__DIR__, 3) . '/app/includes/session_middleware.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace Tests\Framework\Integration\Security;
|
namespace Tests\Framework\Integration\Security;
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/log.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/log.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/helpers/security.php';
|
require_once dirname(__DIR__, 3) . '/app/helpers/security.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace Tests\Framework\Integration\Security;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/includes/security_headers_middleware.php';
|
require_once dirname(__DIR__, 3) . '/app/includes/security_headers_middleware.php';
|
||||||
|
|
||||||
class SecurityHeadersTest extends TestCase
|
class SecurityHeadersTest extends TestCase
|
||||||
{
|
{
|
|
@ -6,20 +6,25 @@ This directory contains the test suite for the Jilo Web application. All testing
|
||||||
|
|
||||||
```
|
```
|
||||||
tests/
|
tests/
|
||||||
├── framework/ # Test framework files
|
├── Unit/ # Unit tests (individual classes and methods)
|
||||||
│ ├── composer.json # Composer configuration for tests
|
├── Classes/
|
||||||
│ ├── phpunit.xml # PHPUnit configuration
|
└── Helpers/
|
||||||
│ ├── Unit/ # Unit tests
|
├── Feature/ # Feature (integration) tests (covering multiple components)
|
||||||
│ ├── Integration/ # Integration tests
|
├── Midleware/
|
||||||
│ └── TestCase.php # Base test case class
|
└── Security/
|
||||||
└── README.md # This file
|
├── Functional/ # Functionl tests (real usage scenarios)
|
||||||
|
├── Utils/ # Custom test utilities and libraries
|
||||||
|
├── TestCase.php # Base test case class
|
||||||
|
├── composer.json # Composer configuration for tests
|
||||||
|
├── phpunit.xml # PHPUnit configuration
|
||||||
|
└── README.md # This file
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running Tests
|
## Running Tests
|
||||||
|
|
||||||
1. Change to the framework directory:
|
1. Change to the test framework directory:
|
||||||
```bash
|
```bash
|
||||||
cd tests/framework
|
cd tests
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Install dependencies (first time only):
|
2. Install dependencies (first time only):
|
||||||
|
@ -37,4 +42,4 @@ composer test
|
||||||
composer test-coverage
|
composer test-coverage
|
||||||
```
|
```
|
||||||
|
|
||||||
The coverage report will be generated in `tests/framework/coverage/`.
|
The coverage report will be generated in `tests/coverage/`.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/database.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/database.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/agent.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/agent.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/database.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/database.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/feedback.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/feedback.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/host.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/host.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/database.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/database.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/server.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/server.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/database.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/database.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/log.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/log.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/database.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/database.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/platform.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/platform.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/database.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/database.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/ratelimiter.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/ratelimiter.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/log.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/log.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/database.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/database.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/settings.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/settings.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/database.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/database.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/user.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/user.php';
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/ratelimiter.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/ratelimiter.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/classes/validator.php';
|
require_once dirname(__DIR__, 3) . '/app/classes/validator.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . '/app/helpers/security.php';
|
require_once dirname(__DIR__, 3) . '/app/helpers/security.php';
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
|
@ -12,21 +12,21 @@
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": [
|
"files": [
|
||||||
"../../app/includes/errors.php",
|
"../app/includes/errors.php",
|
||||||
"../../app/classes/database.php",
|
"../app/classes/database.php",
|
||||||
"../../app/classes/agent.php",
|
"../app/classes/agent.php",
|
||||||
"../../app/classes/host.php",
|
"../app/classes/host.php",
|
||||||
"../../app/classes/platform.php",
|
"../app/classes/platform.php",
|
||||||
"../../app/classes/server.php",
|
"../app/classes/server.php",
|
||||||
"../../app/classes/log.php",
|
"../app/classes/log.php",
|
||||||
"../../app/classes/feedback.php",
|
"../app/classes/feedback.php",
|
||||||
"../../app/classes/settings.php",
|
"../app/classes/settings.php",
|
||||||
"../../app/classes/validator.php",
|
"../app/classes/validator.php",
|
||||||
"../../app/classes/router.php",
|
"../app/classes/router.php",
|
||||||
"../../app/classes/ratelimiter.php",
|
"../app/classes/ratelimiter.php",
|
||||||
"../../app/classes/user.php",
|
"../app/classes/user.php",
|
||||||
"../../app/helpers/security.php",
|
"../app/helpers/security.php",
|
||||||
"../../app/includes/errors.php"
|
"../app/includes/errors.php"
|
||||||
],
|
],
|
||||||
"classmap": [
|
"classmap": [
|
||||||
"TestCase.php"
|
"TestCase.php"
|
|
@ -8,17 +8,20 @@
|
||||||
<testsuite name="Unit">
|
<testsuite name="Unit">
|
||||||
<directory suffix="Test.php">./Unit</directory>
|
<directory suffix="Test.php">./Unit</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Integration">
|
<testsuite name="Feature">
|
||||||
<directory suffix="Test.php">./Integration</directory>
|
<directory suffix="Test.php">./Feature</directory>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="Functional">
|
||||||
|
<directory suffix="Test.php">./Functional</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
<coverage processUncoveredFiles="true">
|
<coverage processUncoveredFiles="true">
|
||||||
<include>
|
<include>
|
||||||
<directory suffix=".php">../../app</directory>
|
<directory suffix=".php">../app</directory>
|
||||||
</include>
|
</include>
|
||||||
<exclude>
|
<exclude>
|
||||||
<directory>../../app/templates</directory>
|
<directory>../app/templates</directory>
|
||||||
<directory>../../app/includes</directory>
|
<directory>../app/includes</directory>
|
||||||
</exclude>
|
</exclude>
|
||||||
</coverage>
|
</coverage>
|
||||||
<php>
|
<php>
|
Loading…
Reference in New Issue