Passed
Pull Request — master (#167)
by Gabriel
05:22
created

DonationAddressChangeTest::testWhenAddressIsUpdated_addressChangeUuidIsUpdated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Store\Tests;
6
7
use Doctrine\ORM\EntityManager;
8
use PHPUnit\Framework\TestCase;
9
use WMDE\Fundraising\Entities\AddressChange;
10
use WMDE\Fundraising\Entities\Donation;
11
12
/**
13
 * @covers WMDE\Fundraising\Entities\AddressChange
14
 */
15
class DonationAddressChangeTest extends TestCase {
16
17
	/**
18
	 * @var EntityManager
19
	 */
20
	private $entityManager;
21
22
	public function setUp(): void {
23
		$this->entityManager = TestEnvironment::newDefault()->getFactory()->getEntityManager();
24
	}
25
26
	public function testWhenDonationIsCreated_addressChangeUuidIsStored(): void {
27
		$this->markTestIncomplete( 'Broken for now, will fix in next commit' );
28
		$donation = new Donation();
29
		$donation->setAddressChange( AddressChange::newDonationAddressChange( AddressChange::ADDRESS_TYPE_PERSON, 1 ) );
0 ignored issues
show
Bug introduced by
The method setAddressChange() does not seem to exist on object<WMDE\Fundraising\Entities\Donation>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
31
		$oldId = $donation->getAddressChange()->getCurrentIdentifier();
0 ignored issues
show
Bug introduced by
The method getAddressChange() does not seem to exist on object<WMDE\Fundraising\Entities\Donation>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
		$this->entityManager->persist( $donation );
33
		$this->entityManager->flush();
34
35
		/** @var Donation $persistedDonation */
36
		$persistedDonation = $this->entityManager->find( Donation::class, 1 );
37
		$this->assertSame(
38
			$oldId,
39
			$persistedDonation->getAddressChange()->getCurrentIdentifier()
0 ignored issues
show
Bug introduced by
The method getAddressChange() does not seem to exist on object<WMDE\Fundraising\Entities\Donation>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
		);
41
	}
42
}
43