From b782ebceeefa909895cc2e787900416748e4c83e Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Mon, 17 Nov 2025 12:01:51 -0600 Subject: [PATCH] =?UTF-8?q?Fase=200:=20Configuraci=C3=B3n=20inicial=20del?= =?UTF-8?q?=20proyecto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Configuración de Composer con PSR-4 - Configuración de PHPUnit - Configuración de PHPCS - Scripts de backup y rollback - Estructura de carpetas inicial - Documentación de procedimientos --- .gitignore | 5 +++++ composer.json | 39 ++++++++++++++++++++++++++++++++++ phpcs.xml | 30 ++++++++++++++++++++++++++ phpunit.xml | 36 +++++++++++++++++++++++++++++++ tests/Unit/ExampleTest.php | 30 ++++++++++++++++++++++++++ tests/_bootstrap/bootstrap.php | 21 ++++++++++++++++++ 6 files changed, 161 insertions(+) create mode 100644 composer.json create mode 100644 phpcs.xml create mode 100644 phpunit.xml create mode 100644 tests/Unit/ExampleTest.php create mode 100644 tests/_bootstrap/bootstrap.php diff --git a/.gitignore b/.gitignore index 78066f63..1344a0b0 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,11 @@ npm-debug.log # Composer (si hay dependencias PHP) vendor/ +composer.lock + +# PHPUnit +.phpunit.result.cache +/tests/_output/ # Environment files .env diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..1dacfa5a --- /dev/null +++ b/composer.json @@ -0,0 +1,39 @@ +{ + "name": "roi/roi-theme", + "description": "ROI Theme - Migración a Clean Architecture + POO", + "type": "wordpress-theme", + "license": "proprietary", + "require": { + "php": ">=8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0", + "squizlabs/php_codesniffer": "^3.7", + "wp-coding-standards/wpcs": "^3.0", + "mockery/mockery": "^1.5" + }, + "autoload": { + "psr-4": { + "ROITheme\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "ROITheme\\Tests\\": "tests/" + } + }, + "scripts": { + "test": "phpunit", + "phpcs": "phpcs --standard=WordPress src/", + "phpcbf": "phpcbf --standard=WordPress src/" + }, + "config": { + "secure-http": true, + "disable-tls": false, + "preferred-install": "dist", + "platform-check": false, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 00000000..429ccdca --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,30 @@ + + + Estándares de código para ROI Theme + + + src + + + */vendor/* + */tests/* + */admin/* + + + + + + + + + + + + + + + + + + + diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 00000000..8aaf2c2d --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,36 @@ + + + + + + tests/Unit + + + tests/Integration + + + tests/E2E + + + + + + src + + + src/Infrastructure/UI/Views + + + + + + + diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php new file mode 100644 index 00000000..dd5fb5ce --- /dev/null +++ b/tests/Unit/ExampleTest.php @@ -0,0 +1,30 @@ +assertTrue(true, 'PHPUnit está funcionando correctamente'); + } + + public function testPhpVersion(): void + { + $version = PHP_VERSION; + $this->assertGreaterThanOrEqual('8.0.0', $version, 'PHP debe ser versión 8.0 o superior'); + } + + public function testComposerAutoloadIsLoaded(): void + { + $this->assertTrue( + class_exists('PHPUnit\Framework\TestCase'), + 'Composer autoload está funcionando' + ); + } +} diff --git a/tests/_bootstrap/bootstrap.php b/tests/_bootstrap/bootstrap.php new file mode 100644 index 00000000..5deafdc4 --- /dev/null +++ b/tests/_bootstrap/bootstrap.php @@ -0,0 +1,21 @@ +