ufService = $this->getMockBuilder(Service\UF::class) ->disableOriginalConstructor() ->getMock(); $this->ufService->method('get')->willReturn(35000.0); } public static function cleanDataProvider(): array { return [ ['1.003.000,01', 1003000.01], ['4,273.84', 4273.84], [443.75, 443.75], ['443.75', 443.75] ]; } #[DataProvider('cleanDataProvider')] public function testClean($input, $expected): void { $valorService = new Valor($this->ufService); $result = $valorService->clean($input); $this->assertIsFloat($result); $this->assertEquals($expected, $result); } public static function ufsDataProvider(): array { return [ ['1000000', 28.57143], [443.75, 443.75] ]; } public function testToUF() { $date = '2025-01-01'; $valorService = new Valor($this->ufService); $input = '1000000'; $result = $valorService->toUF($input, $date); $this->assertIsFloat($result); $this->assertEquals($input / 35000, $result); } public static function pesosDataProvider(): array { return [ [1000.01, 1000.01*35000, false], [1000, 1000*35000, true], ['1000', 1000, false], ]; } #[DataProvider('pesosDataProvider')] public function testToPesos($input, $expected, $force) { $date = '2025-01-01'; $valorService = new Valor($this->ufService); $result = $valorService->toPesos($input, $date, $force); $this->assertIsInt($result); $this->assertEquals($expected, $result); } }