This commit is contained in:
nuno maduro
2026-04-22 08:07:52 -07:00
parent 856a370032
commit c6a42a2b28
22 changed files with 1259 additions and 4 deletions

View File

@ -0,0 +1,27 @@
{
"name": "pest/tia-sample-project",
"type": "project",
"description": "Throw-away fixture used by tests-tia to exercise TIA end-to-end.",
"require": {
"php": "^8.3"
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
failOnRisky="false"
failOnWarning="false"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerNotices="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src</directory>
</include>
</source>
</phpunit>

View File

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace App;
final class Greeter
{
public static function greet(string $name): string
{
return sprintf('Hello, %s!', $name);
}
}

View File

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace App;
final class Math
{
public static function add(int $a, int $b): int
{
return $a + $b;
}
}

View File

@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
use App\Greeter;
test('greeter greets', function () {
expect(Greeter::greet('Nuno'))->toBe('Hello, Nuno!');
});

View File

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
use App\Math;
test('math add', function () {
expect(Math::add(2, 3))->toBe(5);
});
test('math add negative', function () {
expect(Math::add(-1, 1))->toBe(0);
});

View File

@ -0,0 +1,7 @@
<?php
declare(strict_types=1);
// Intentionally minimal — tests-tia exercises TIA against the simplest
// possible Pest harness. Anything more and we end up debugging the
// fixture instead of the feature under test.