Se mueve todo a extension de pruebas

This commit is contained in:
Juan Pablo Vial
2025-04-29 23:55:51 -04:00
parent dd1741a930
commit 87c0d8c8d9
7 changed files with 57 additions and 4 deletions

View File

@ -0,0 +1,15 @@
<?php
namespace ProVM\Tests\Extension;
use GuzzleHttp\Client;
use PHPUnit\Framework\TestCase;
use Psr\Http\Client\ClientInterface;
abstract class AbstractIntegration extends TestCase
{
protected ClientInterface $client;
protected function setUp(): void
{
$this->client = new Client(['base_uri' => $_ENV['APP_URL']]);
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace ProVM\Tests\Extension;
use PHPUnit\Framework\TestCase;
use Incoviba\Common\Define\Model;
abstract class AbstractModel extends TestCase
{
protected Model $model;
}

View File

@ -0,0 +1,17 @@
<?php
namespace ProVM\Tests\Extension;
use PHPUnit\Framework\TestCase;
abstract class AbstractPerformance extends TestCase
{
protected float $startTime;
protected function start(): void
{
$this->startTime = microtime(true);
}
protected function end(): float
{
return microtime(true) - $this->startTime;
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace ProVM\Tests\Extension;
trait ObjectHasMethodTrait
{
public function assertObjectHasMethod(string $method, object $object): void
{
$this->assertTrue(method_exists($object, $method), sprintf('The object %s does not have the method %s', get_class($object), $method));
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace ProVM\Tests\Extension;
trait testMethodsTrait
{
use ObjectHasMethodTrait;
public function testMethods(): void
{
$object = $this->model;
foreach ($this->methods as $method) {
$this->assertObjectHasMethod($method, $object);
}
}
protected array $methods = [];
}

View File

@ -0,0 +1,24 @@
<?php
namespace ProVM\Tests\Extension;
use Incoviba\Common\Define\Model;
trait testPropertiesTrait
{
use ObjectHasMethodTrait;
public function testProperties(): void
{
$model = $this->model;
$this->assertProperties($model);
}
protected array $properties = [];
protected function assertProperties(Model $model): void
{
foreach ($this->properties as $key) {
$this->assertObjectHasProperty($key, $model);
}
}
}