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

MembershipAddressChangeTest::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\MembershipApplication;
11
12
/**
13
 * @covers WMDE\Fundraising\Entities\AddressChange
14
 */
15
class MembershipAddressChangeTest 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 testWhenMembershipApplicationIsCreated_addressChangeUuidIsStored(): void {
27
		$this->markTestIncomplete( 'Broken for now, will fix in next commit' );
28
		$application = new MembershipApplication();
29
		$application->setAddressChange( AddressChange::newMembershipAddressChange( AddressChange::ADDRESS_TYPE_PERSON, 1 ) );
0 ignored issues
show
Bug introduced by
The method setAddressChange() does not exist on WMDE\Fundraising\Entities\MembershipApplication. Did you maybe mean setAddress()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
30
31
		$oldId = $application->getAddressChange()->getCurrentIdentifier();
0 ignored issues
show
Bug introduced by
The method getAddressChange() does not exist on WMDE\Fundraising\Entities\MembershipApplication. Did you maybe mean getAddress()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
32
		$this->entityManager->persist( $application );
33
		$this->entityManager->flush();
34
35
		/** @var MembershipApplication $persistedApplication */
36
		$persistedApplication = $this->entityManager->find( MembershipApplication::class, 1 );
37
		$this->assertSame(
38
			$oldId,
39
			$persistedApplication->getAddressChange()->getCurrentIdentifier()
0 ignored issues
show
Bug introduced by
The method getAddressChange() does not exist on WMDE\Fundraising\Entities\MembershipApplication. Did you maybe mean getAddress()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

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