Completed
Push — master ( 7c7194...e778af )
by wiese
14s
created

integration/MembershipApplicationInsertionTest.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Store\Tests;
6
7
use PHPUnit\Framework\TestCase;
8
use WMDE\Fundraising\Entities\MembershipApplication;
9
10
/**
11
 * @covers \WMDE\Fundraising\Entities\MembershipApplication
12
 */
13
class MembershipApplicationInsertionTest extends TestCase {
14
15
	public function testNewMembershipApplicationCanBeInserted(): void {
16
		$entityManager = TestEnvironment::newDefault()->getFactory()->getEntityManager();
17
		$entityManager->persist( new MembershipApplication() );
18
		$entityManager->flush();
19
20
		$count = $entityManager->createQueryBuilder()
21
			->select( 'COUNT(r.id)' )
22
			->from( MembershipApplication::class, 'r' )
23
			->getQuery()
24
			->getSingleScalarResult();
25
26
		$this->assertSame( '1', $count );
27
	}
28
29
	public function testMembershipApplicationCanBeLoaded(): void {
30
		$entityManager = TestEnvironment::newDefault()->getFactory()->getEntityManager();
31
32
		$application = new MembershipApplication();
33
		$application->setDonationReceipt( true );
34
35
		$entityManager->persist( $application );
36
		$entityManager->flush();
37
38
		/**
39
		 * @var MembershipApplication $application
40
		 */
41
		$application = $entityManager->getRepository( MembershipApplication::class )->find( $application->getId() );
42
43
		$this->assertTrue( $application->getDonationReceipt() );
0 ignored issues
show
It seems like $application->getDonationReceipt() targeting WMDE\Fundraising\Entitie...n::getDonationReceipt() can also be of type null; however, PHPUnit\Framework\Assert::assertTrue() does only seem to accept boolean, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
44
	}
45
}
46