---
title: "InvoiceFactory – API-Referenz · Quittio"
description: "Test data factory: InvoiceData::factory()->reverseCharge()->withLines(5)->make()."
canonical_url: "https://quittio.dev/docs/api/Quittio/Core/Testing/InvoiceFactory"
locale: de
meta:
  "og:description": "Test data factory: InvoiceData::factory()->reverseCharge()->withLines(5)->make()."
  "og:image": "https://quittio.dev/og/quittio-de.jpg"
  "og:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
  "og:image:height": "630"
  "og:image:type": image/jpeg
  "og:image:width": "1200"
  "og:title": "InvoiceFactory – API-Referenz · Quittio"
  "twitter:image": "https://quittio.dev/og/quittio-de.jpg"
  "twitter:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
---

> Index of every page on this site: [llms.txt](https://quittio.dev/llms.txt)

[API reference](https://quittio.dev/docs/api) / [Quittio](https://quittio.dev/docs/api/Quittio) \\ [Core](https://quittio.dev/docs/api/Quittio/Core) \\ [Testing](https://quittio.dev/docs/api/Quittio/Core/Testing)

# InvoiceFactory

final class in quittio/core

`Quittio\Core\Testing\InvoiceFactory` · [Source](https://github.com/Quittio/quittio/blob/v0.7.1/packages/core/src/Testing/InvoiceFactory.php#L24)

Test data factory: InvoiceData::factory()->reverseCharge()->withLines(5)->make().

Deterministic (no random values), so that snapshots stay stable.

## Methods \#

| Method | Description |
| --- | --- |
| `->b2c()` | |
| `->builder()` | |
| `->calculated()` | Invoice data with totals and VAT breakdown, calculated with $calculator (default: En16931Calculator). |
| `->creditNote()` | |
| `->currency()` | |
| `->export()` | |
| `->intraCommunity()` | |
| `->make()` | Uncalculated invoice data. |
| `::new()` | |
| `->number()` | |
| `->reverseCharge()` | |
| `->state()` | Free modification of the builder. |
| `->withLines()` | |

### `b2c()`#

```
public function b2c(): self
```

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `builder()`#

```
public function builder(): InvoiceBuilder
```

<dl><dt>Returns</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Builder/InvoiceBuilder">InvoiceBuilder</a></code></dd>
</dl>

### `calculated()`#

```
public function calculated(?TotalsCalculator $calculator = null): InvoiceData
```

Invoice data with totals and VAT breakdown, calculated with $calculator (default: En16931Calculator).

| Parameter | Type | Description |
| --- | --- | --- |
| `$calculator` | `? [TotalsCalculator](https://quittio.dev/docs/api/Quittio/Core/Calculation/TotalsCalculator)` = `null` | |

<dl><dt>Returns</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Data/InvoiceData">InvoiceData</a></code></dd>
</dl>

### `creditNote()`#

```
public function creditNote(): self
```

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `currency()`#

```
public function currency(string $currency): self
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$currency` | `string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `export()`#

```
public function export(): self
```

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `intraCommunity()`#

```
public function intraCommunity(): self
```

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `make()`#

```
public function make(): InvoiceData
```

Uncalculated invoice data.

<dl><dt>Returns</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Data/InvoiceData">InvoiceData</a></code></dd>
</dl>

### `new()`#

```
public static function new(): self
```

static

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `number()`#

```
public function number(string $number): self
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$number` | `string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `reverseCharge()`#

```
public function reverseCharge(): self
```

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `state()`#

```
public function state(callable $state): self
```

Free modification of the builder.

| Parameter | Type | Description |
| --- | --- | --- |
| `$state` | `callable` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `withLines()`#

```
public function withLines(int $count): self
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$count` | `int` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://quittio.dev/#website","@type":"WebSite","description":"E-Rechnungen für PHP und Laravel: ZUGFeRD, XRechnung und Peppol erstellen, prüfen, lesen und archivieren.","inLanguage":"de-DE","name":"Quittio","url":"https://quittio.dev/","publisher":{"@id":"https://quittio.dev/#identity"},"workTranslation":{"@id":"https://quittio.dev/en#website"}},{"@id":"https://quittio.dev/docs/api/Quittio/Core/Testing/InvoiceFactory#webpage","@type":"WebPage","description":"Test data factory: InvoiceData::factory()->reverseCharge()->withLines(5)->make().","name":"InvoiceFactory – API-Referenz","url":"https://quittio.dev/docs/api/Quittio/Core/Testing/InvoiceFactory","isPartOf":{"@id":"https://quittio.dev/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/docs/api/Quittio/Core/Testing/InvoiceFactory"]}],"primaryImageOfPage":{"@id":"https://quittio.dev/#logo"}},{"@id":"https://quittio.dev/#identity","@type":"Organization","description":"Open-Source-Bibliothek für E-Rechnungen in PHP und Laravel (ZUGFeRD, XRechnung, Peppol) und Quittio Managed.","email":"kontakt@niklasforst.de","legalName":"Niklas Forst – Softwareentwicklung","name":"Quittio","url":"https://quittio.dev","founder":{"@type":"Person","name":"Niklas Forst","url":"https://quittio.dev/ueber"},"logo":{"@id":"https://quittio.dev/#logo"},"sameAs":["https://github.com/Quittio/quittio","https://packagist.org/packages/quittio/quittio"]},{"@id":"https://quittio.dev/#logo","@type":"ImageObject","caption":"Quittio","contentUrl":"https://quittio.dev/logo.png","inLanguage":"de-DE","url":"https://quittio.dev/logo.png"}]}
```