Skip to content

Commit

Permalink
feat(tests): add single test for base miguel file
Browse files Browse the repository at this point in the history
  • Loading branch information
samnung committed Feb 23, 2024
1 parent 3317a17 commit 8e9cca9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/php_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions miguel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
29 changes: 29 additions & 0 deletions tests/Unit/MiguelTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* 2023 Servantes
*
* This file is licenced under the Software License Agreement.
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* You must not modify, adapt or create derivative works of this source code
*
* @author Pavel Vejnar <vejnar.p@gmail.com>
* @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'));
}
}

0 comments on commit 8e9cca9

Please sign in to comment.