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 @@ +