premiers tests ok

This commit is contained in:
2024-06-12 13:02:54 +02:00
commit c2aaf2183e
127 changed files with 12738 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace Tests\Traits;
trait GeneratesTestDirectory
{
/**
* @var string
*/
protected static $testDirectory;
/**
* Create a tests directory and make it the current directory.
*
* @return void
*/
public static function setUpBeforeClass(): void
{
self::$testDirectory = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('homestead_', true);
mkdir(self::$testDirectory);
chdir(self::$testDirectory);
}
/**
* Delete the tests directory.
*
* @return void
*/
public static function tearDownAfterClass(): void
{
rmdir(self::$testDirectory);
}
/**
* Delete all the files inside the tests directory.
*
* @return void
*/
public function tearDown(): void
{
exec('rm -rf '.self::$testDirectory.DIRECTORY_SEPARATOR.'*');
}
}