|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * This file is part of Informes plugin for FacturaScripts |
| 4 | + * Copyright (C) 2026 Carlos García Gómez <carlos@facturascripts.com> |
| 5 | + * |
| 6 | + * This program is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU Lesser General Public License as |
| 8 | + * published by the Free Software Foundation, either version 3 of the |
| 9 | + * License, or (at your option) any later version. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU Lesser General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU Lesser General Public License |
| 17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | + |
| 20 | +namespace FacturaScripts\Test\Plugins; |
| 21 | + |
| 22 | +use FacturaScripts\Dinamic\Model\Ejercicio; |
| 23 | +use FacturaScripts\Plugins\Informes\Controller\ReportTreasury; |
| 24 | +use PHPUnit\Framework\TestCase; |
| 25 | + |
| 26 | +final class ReportTreasuryTest extends TestCase |
| 27 | +{ |
| 28 | + public function testCurrentCorporateTaxUsesCurrentExercisePercentage(): void |
| 29 | + { |
| 30 | + $report = new class ('ReportTreasury') extends ReportTreasury { |
| 31 | + public function calculateTaxes(float $currentPercentage, float $previousPercentage): array |
| 32 | + { |
| 33 | + $this->ejercicio = new Ejercicio(); |
| 34 | + $this->ejercicio->impsociedades = $currentPercentage; |
| 35 | + $this->ejercicio_ant = new Ejercicio(); |
| 36 | + $this->ejercicio_ant->impsociedades = $previousPercentage; |
| 37 | + $this->desde = '2026-01-01'; |
| 38 | + $this->hasta = '2026-12-31'; |
| 39 | + |
| 40 | + $this->cuadroImpuestos(); |
| 41 | + return $this->da_impuestos; |
| 42 | + } |
| 43 | + |
| 44 | + protected function getVentasTotales(): float |
| 45 | + { |
| 46 | + return 1000.0; |
| 47 | + } |
| 48 | + |
| 49 | + protected function saldoCuenta(string $cuenta, string $desde, string $hasta): float |
| 50 | + { |
| 51 | + return 0.0; |
| 52 | + } |
| 53 | + }; |
| 54 | + |
| 55 | + $taxes = $report->calculateTaxes(25.0, 10.0); |
| 56 | + $this->assertSame(-250.0, $taxes['sociedades']); |
| 57 | + $this->assertSame(-250.0, $taxes['pagofraccionado-mod202']); |
| 58 | + } |
| 59 | +} |
0 commit comments