Add PHPUnit for testing

This commit is contained in:
Ramon Caballero 2026-04-09 13:58:14 +01:00
parent 732b0c7e0c
commit ba5a8dc8ea
7 changed files with 1721 additions and 1 deletions

4
.gitignore vendored
View File

@ -9,3 +9,7 @@ var/
# Composer dependencies: # Composer dependencies:
/vendor/ /vendor/
# PHPUnit caches:
.phpunit.cache/
.phpunit.result.cache

View File

@ -12,5 +12,7 @@
"PHPStarter\\": "src/" "PHPStarter\\": "src/"
} }
}, },
"require": {} "require-dev": {
"phpunit/phpunit": "^12.5"
}
} }

1690
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

10
phpunit.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"
bootstrap="tests/bootstrap.php">
<testsuites>
<testsuite name="PHPStarter Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

View File

11
tests/ExampleTest.php Normal file
View File

@ -0,0 +1,11 @@
<?php
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
public function test_it_works()
{
$this->assertTrue(true);
}
}

3
tests/bootstrap.php Normal file
View File

@ -0,0 +1,3 @@
<?php
require __DIR__ . '/../vendor/autoload.php';