Skip to content

Commit 540996b

Browse files
committed
Fixing bugs in test that I missed in the PR
At least for using Maker, your code won't work immediately if you have required constructor args. So, to get a successful "we ran make and then we can immeidately use the code in the test", those were removed
1 parent c8faf8b commit 540996b

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

tests/fixtures/MakeEntityRegenerateEmbeddableObject/src/Entity/Currency.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Currency
1616
*/
1717
private $currency;
1818

19-
public function __construct($currency)
19+
public function __construct($currency = null)
2020
{
2121
$this->currency = $currency;
2222
}
@@ -36,6 +36,7 @@ public function getCurrency()
3636
public function setCurrency($currency)
3737
{
3838
$this->currency = $currency;
39+
3940
return $this;
4041
}
4142

tests/fixtures/MakeEntityRegenerateEmbeddableObject/src/Entity/Money.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use Doctrine\ORM\Mapping as ORM;
66

7+
/**
8+
* @ORM\Embeddable
9+
*/
710
class Money
811
{
912
/**
@@ -20,9 +23,9 @@ class Money
2023
*/
2124
private $amount;
2225

23-
public function __construct($amount, Currency $currency)
26+
public function __construct($amount = null, Currency $currency = null)
2427
{
2528
$this->amount = $amount;
26-
$this->currency = $currency;
29+
$this->currency = $currency ?? new Currency();
2730
}
2831
}

tests/fixtures/MakeEntityRegenerateEmbeddableObject/tests/GeneratedEntityTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace App\Tests;
44

55
use App\Entity\Invoice;
6-
use Money\Currency;
7-
use Money\Money;
6+
use App\Entity\Currency;
7+
use App\Entity\Money;
88
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
99
use Doctrine\ORM\EntityManager;
1010

0 commit comments

Comments
 (0)