added command to create invoices via bash (#1574)

This commit is contained in:
Kevin Papst
2020-03-20 13:14:05 +01:00
committed by GitHub
parent 7b13ea860a
commit b8c5323ece
35 changed files with 1301 additions and 273 deletions

View File

@@ -9,12 +9,15 @@
namespace App\Tests\Invoice;
use App\Entity\Invoice;
use App\Entity\InvoiceDocument;
use App\Invoice\Calculator\DefaultCalculator;
use App\Invoice\NumberGenerator\DateNumberGenerator;
use App\Invoice\Renderer\TwigRenderer;
use App\Invoice\ServiceInvoice;
use App\Repository\InvoiceDocumentRepository;
use App\Repository\InvoiceRepository;
use App\Tests\Mocks\Security\UserDateTimeFactoryFactory;
use App\Utils\FileHelper;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
@@ -27,8 +30,18 @@ class ServiceInvoiceTest extends TestCase
private function getSut(array $paths): ServiceInvoice
{
$repo = new InvoiceDocumentRepository($paths);
$invoiceRepo = $this->createMock(InvoiceRepository::class);
$userDateTime = (new UserDateTimeFactoryFactory($this))->create();
return new ServiceInvoice($repo, new FileHelper(realpath(__DIR__ . '/../../var/data/')));
return new ServiceInvoice($repo, new FileHelper(realpath(__DIR__ . '/../../var/data/')), $invoiceRepo, $userDateTime, new DebugFormatter());
}
public function testInvalidExceptionOnChangeState()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unknown invoice status');
$sut = $this->getSut([]);
$sut->changeInvoiceStatus(new Invoice(), 'foo');
}
public function testEmptyObject()