diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml
new file mode 100644
index 0000000..50f5c65
--- /dev/null
+++ b/.gitea/workflows/test.yaml
@@ -0,0 +1,19 @@
+name: Launch the PHPunit tests
+on:
+ push:
+
+
+jobs:
+ phpunit-tests:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out repository code
+ uses: actions/checkout@v4
+ - name: Set up PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '8.1'
+ - name: Install dependencies
+ run: composer install
+ - name: Run PHPUnit tests
+ run: vendor/bin/phpunit --configuration phpunit.xml
diff --git a/phpunit.xml b/phpunit.xml
index 506b9a3..61c031c 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -22,8 +22,8 @@
-
-
+
+
diff --git a/tests/Feature/EldoradoRobuxPriceSentryJob/textToFLoatTest.php b/tests/Feature/EldoradoRobuxPriceSentryJob/textToFLoatTest.php
new file mode 100644
index 0000000..6fd5662
--- /dev/null
+++ b/tests/Feature/EldoradoRobuxPriceSentryJob/textToFLoatTest.php
@@ -0,0 +1,54 @@
+job = new EldoradoRobuxPriceSentryJob();
+ }
+
+ private function assertTextToFloat($input, $expected) {
+ $reflection = new ReflectionMethod(EldoradoRobuxPriceSentryJob::class, 'textToFloat');
+ $reflection->setAccessible(true);
+ $result = $reflection->invoke($this->job, $input);
+ $this->assertEquals($expected, $result, "Failed asserting that textToFloat('$input') equals $expected. Got $result instead.");
+ }
+
+
+ public function test_simple_int(): void
+ {
+ $this->assertTextToFloat("10", 10.0);
+ $this->assertTextToFloat(" 42", 42.0);
+ }
+
+ public function test_decimal_numbers(): void
+ {
+ $this->assertTextToFloat("3,14", 3.14);
+ $this->assertTextToFloat(" 0,0015 ", 0.0015);
+ }
+
+ public function test_money_symbols_int(): void
+ {
+ $this->assertTextToFloat("5 €", 5.0);
+ $this->assertTextToFloat(" € 123 ", 123.0);
+ }
+
+ public function test_money_symbols_decimal(): void
+ {
+ $this->assertTextToFloat("7,89 €", 7.89);
+ $this->assertTextToFloat(" € 0,75 ", 0.75);
+ $this->assertTextToFloat(" €0.00402 ", 0.00402);
+ $this->assertTextToFloat(" 0,00429 € ", 0.00429);
+ }
+}
+