Se mueve todo a extension de pruebas
This commit is contained in:
@ -150,6 +150,7 @@ class TestBootstrap
|
|||||||
spl_autoload_register(function($className) {
|
spl_autoload_register(function($className) {
|
||||||
$baseTestPath = __DIR__ . "/tests";
|
$baseTestPath = __DIR__ . "/tests";
|
||||||
$namespaceMap = [
|
$namespaceMap = [
|
||||||
|
"ProVM\\Tests\\Extension\\" => "{$baseTestPath}/extension",
|
||||||
"ProVM\\Integration\\" => "{$baseTestPath}/integration",
|
"ProVM\\Integration\\" => "{$baseTestPath}/integration",
|
||||||
"ProVM\\Unit\\" => "{$baseTestPath}/unit/src",
|
"ProVM\\Unit\\" => "{$baseTestPath}/unit/src",
|
||||||
"ProVM\\Performance\\" => "{$baseTestPath}/performance",
|
"ProVM\\Performance\\" => "{$baseTestPath}/performance",
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace ProVM\Integration;
|
namespace ProVM\Tests\Extension;
|
||||||
|
|
||||||
use Psr\Http\Client\ClientInterface;
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Psr\Http\Client\ClientInterface;
|
||||||
|
|
||||||
abstract class AbstractIntegration extends TestCase
|
abstract class AbstractIntegration extends TestCase
|
||||||
{
|
{
|
10
app/tests/extension/AbstractModel.php
Normal file
10
app/tests/extension/AbstractModel.php
Normal 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;
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace ProVM\Performance;
|
namespace ProVM\Tests\Extension;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace ProVM\Unit;
|
namespace ProVM\Tests\Extension;
|
||||||
|
|
||||||
trait ObjectHasMethodTrait
|
trait ObjectHasMethodTrait
|
||||||
{
|
{
|
18
app/tests/extension/testMethodsTrait.php
Normal file
18
app/tests/extension/testMethodsTrait.php
Normal 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 = [];
|
||||||
|
}
|
24
app/tests/extension/testPropertiesTrait.php
Normal file
24
app/tests/extension/testPropertiesTrait.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user