diff --git a/.gitattributes b/.gitattributes index 88abbec..edc1f30 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ /.* export-ignore /Examples export-ignore +/phpunit.xml export-ignore diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 81f5e16..b2b0a20 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,7 +29,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - extensions: none, curl, json, mbstring + extensions: none, curl, dom, json, mbstring, tokenizer, xml, xmlwriter coverage: none - id: composer-cache @@ -44,3 +44,5 @@ jobs: - run: composer update --no-progress --classmap-authoritative - run: ./vendor/bin/parallel-lint . --exclude vendor + + - run: ./vendor/bin/phpunit diff --git a/.github/workflows/sca.yaml b/.github/workflows/sca.yaml index e9b0f1d..4e8ed74 100644 --- a/.github/workflows/sca.yaml +++ b/.github/workflows/sca.yaml @@ -13,7 +13,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: php-version: 8.2 - extensions: none, curl, dom, mbstring, simplexml, tokenizer + extensions: none, curl, dom, mbstring, simplexml, tokenizer, xml, xmlwriter coverage: none - run: composer update --no-progress --classmap-authoritative diff --git a/composer.json b/composer.json index 5ac66bb..0a79497 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "phpseclib/phpseclib": "^2 || ^3" }, "require-dev": { - "php-parallel-lint/php-parallel-lint": "^1.3.2" + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpunit/phpunit": "^5.7.27 || ^9.6.10" }, "autoload": { "psr-4": { @@ -31,6 +32,11 @@ "**/Examples/" ] }, + "autoload-dev": { + "psr-4": { + "Tpay\\Tests\\": "tests/" + } + }, "extra": [ { "engine": "PHP SDK" diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..32f5fe9 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,33 @@ + + + + + + ./tests + + + + + + + + + diff --git a/tests/Model/ModelsTest.php b/tests/Model/ModelsTest.php new file mode 100644 index 0000000..ec77c22 --- /dev/null +++ b/tests/Model/ModelsTest.php @@ -0,0 +1,42 @@ +isFile()) { + continue; + } + + $className = 'tpaySDK\\Model\\'.substr( + $fileInfo->getRealPath(), + strlen($modelDirectory) + 1, + -4 + ); + $className = str_replace('/', '\\', $className); + + yield $className => [$className]; + } + } +}