From 8e9cca99158883dbf4559f8fb85f51e64811a154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20K=C5=99=C3=AD=C5=BE?= Date: Fri, 23 Feb 2024 13:47:37 +0100 Subject: [PATCH] feat(tests): add single test for base miguel file --- .github/workflows/php_tests.yml | 2 +- miguel.php | 3 +++ tests/Unit/MiguelTest.php | 29 +++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tests/Unit/MiguelTest.php diff --git a/.github/workflows/php_tests.yml b/.github/workflows/php_tests.yml index 36af2b1..2e5147b 100644 --- a/.github/workflows/php_tests.yml +++ b/.github/workflows/php_tests.yml @@ -142,7 +142,7 @@ jobs: env: MYSQL_ROOT_PASSWORD: 'password' ports: - - 3306/tcp + - 3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 steps: - name: Checkout diff --git a/miguel.php b/miguel.php index 994e157..f407cc8 100644 --- a/miguel.php +++ b/miguel.php @@ -605,6 +605,9 @@ public function getAllProducts() return $all_products_ret; } + /** + * @param string $updated_since ISO 8601 date + */ public function getUpdatedOrders($updated_since) { $date_upd = date('Y-m-d H:i:s', strtotime($updated_since)); diff --git a/tests/Unit/MiguelTest.php b/tests/Unit/MiguelTest.php new file mode 100644 index 0000000..38752dd --- /dev/null +++ b/tests/Unit/MiguelTest.php @@ -0,0 +1,29 @@ + + * @copyright 2022 - 2023 Servantes + * @license LICENSE.txt + */ + +namespace Tests\Unit\utils; + +use PHPUnit\Framework\TestCase; + +require_once __DIR__ . '/../../miguel.php'; + +final class MiguelTest extends TestCase +{ + public function testGetUpdatedOrders() + { + $miguel = new \Miguel(); + $this->assertIsArray($miguel->getUpdatedOrders('2022-01-01')); + } +}