diff --git a/.gitattributes b/.gitattributes index 6313b56..b4c6036 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,14 @@ * text=auto eol=lf + +# Files excluded from the distribution archive installed by Composer. +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.github export-ignore +/AGENTS.md export-ignore +/especificaciones-orm.md export-ignore +/mago.toml export-ignore +/mago-baseline.toml export-ignore +/phpstan.neon export-ignore +/phpunit.xml.dist export-ignore +/phpunit.integration.xml.dist export-ignore diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml new file mode 100644 index 0000000..d54e019 --- /dev/null +++ b/.gitea/workflows/tests.yml @@ -0,0 +1,34 @@ +name: Tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + check: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['8.3', '8.4'] + + name: PHP ${{ matrix.php }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring, pdo, pdo_mysql, json + coverage: none + tools: composer:v2 + + - name: Install dependencies + run: composer update --prefer-dist --no-interaction --no-progress + + - name: Run gate + run: composer check diff --git a/README.md b/README.md index 5de61a8..10b81c0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ -# camelia-orm +# camelia/orm -Lightweight attribute-mapped Active Record ORM for MariaDB/MySQL over PDO, by Dr2g Sistemas. +[![Latest Stable Version](https://img.shields.io/packagist/v/camelia/orm.svg)](https://packagist.org/packages/camelia/orm) +[![Total Downloads](https://img.shields.io/packagist/dt/camelia/orm.svg)](https://packagist.org/packages/camelia/orm) +[![License](https://img.shields.io/packagist/l/camelia/orm.svg)](https://packagist.org/packages/camelia/orm) +[![Tests](https://git.dr2gsistemas.duckdns.org/dr2gsistemas/camelia-orm/actions/workflows/tests.yml/badge.svg)](https://git.dr2gsistemas.duckdns.org/dr2gsistemas/camelia-orm/actions) + +Lightweight attribute-mapped Active Record ORM for MariaDB/MySQL over PDO. - **Package:** `camelia/orm` ยท **Namespace:** `Camelia\Orm` - **PHP** `>=8.3`, extensions `pdo_mysql` and `mbstring` diff --git a/composer.json b/composer.json index d62e01b..87feb20 100644 --- a/composer.json +++ b/composer.json @@ -37,6 +37,7 @@ "scripts": { "test": "phpunit --configuration phpunit.xml.dist", "test:integration": "phpunit --configuration phpunit.integration.xml.dist", + "coverage": "phpunit --configuration phpunit.coverage.xml.dist --coverage-text", "fmt": "mago fmt", "fmt:check": "mago fmt --check", "lint": "mago lint", diff --git a/phpunit.coverage.xml.dist b/phpunit.coverage.xml.dist new file mode 100644 index 0000000..5d24d68 --- /dev/null +++ b/phpunit.coverage.xml.dist @@ -0,0 +1,31 @@ + + + + + + tests/Unit + + + + + src + + + + + + + + + + diff --git a/phpunit.integration.xml.dist b/phpunit.integration.xml.dist index a09c88f..6d4478e 100644 --- a/phpunit.integration.xml.dist +++ b/phpunit.integration.xml.dist @@ -12,6 +12,11 @@ - + + + + + + diff --git a/tests/Integration/ConnectionTest.php b/tests/Integration/ConnectionTest.php new file mode 100644 index 0000000..290d9a1 --- /dev/null +++ b/tests/Integration/ConnectionTest.php @@ -0,0 +1,52 @@ + $host, + 'user' => $user, + 'database' => $database, + 'password' => $password === false ? '' : $password, + 'port' => $port === false ? 3306 : (int) $port, + ]; + } + + #[Test] + public function it_connects_to_the_configured_database(): void + { + $orm = Orm::fromArray($this->optionsOrSkip()); + + self::assertSame(1, (int) $orm->connection()->scalar('SELECT 1')); + } +}