|
|
@@ -34,6 +34,7 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
private MockObject|Access $access;
|
|
|
private MockObject|OrganizationProfile $organizationProfile;
|
|
|
private MockObject|EntityManagerInterface $entityManager;
|
|
|
+ private MockObject|Preferences $preferences;
|
|
|
|
|
|
public function setUp(): void
|
|
|
{
|
|
|
@@ -52,6 +53,7 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$this->access = $this->getMockBuilder(Access::class)->getMock();
|
|
|
$this->organizationProfile = $this->getMockBuilder(OrganizationProfile::class)->getMock();
|
|
|
$this->accessProfile = $this->getMockBuilder(AccessProfile::class)->getMock();
|
|
|
+ $this->preferences = $this->getMockBuilder(Preferences::class)->getMock();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -273,6 +275,7 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$this->access->method('getBillingPayers')->willReturn($this->emptyCollection);
|
|
|
$this->access->method('getBillingReceivers')->willReturn($this->emptyCollection);
|
|
|
$this->access->method('getAccessIntangibles')->willReturn($this->emptyCollection);
|
|
|
+ $this->access->method('getPreferences')->willReturn($this->preferences);
|
|
|
|
|
|
$this->accessProfile->expects(self::once())->method('setIsAdminAccess')->with(true)->willReturnSelf();
|
|
|
$this->accessProfile->expects(self::once())->method('setRoles')->with(['FOO'])->willReturnSelf();
|
|
|
@@ -281,6 +284,8 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$this->accessProfile->expects(self::once())->method('setIsGuardian')->with(false)->willReturnSelf();
|
|
|
$this->accessProfile->expects(self::once())->method('setIsPayor')->with(false)->willReturnSelf();
|
|
|
|
|
|
+ $this->preferences->expects(self::once())->method('getId')->willReturn(1);
|
|
|
+
|
|
|
$this->accessProfileCreator->createCompleteAccessProfile($this->access);
|
|
|
}
|
|
|
|
|
|
@@ -297,8 +302,10 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$this->access->method('getBillingPayers')->willReturn($this->emptyCollection);
|
|
|
$this->access->method('getBillingReceivers')->willReturn($this->emptyCollection);
|
|
|
$this->access->method('getAccessIntangibles')->willReturn($this->emptyCollection);
|
|
|
+ $this->access->method('getPreferences')->willReturn($this->preferences);
|
|
|
|
|
|
$this->accessProfile->expects(self::once())->method('setIsGuardian')->with(true)->willReturnSelf();
|
|
|
+ $this->preferences->expects(self::once())->method('getId')->willReturn(1);
|
|
|
|
|
|
$this->accessProfileCreator->createCompleteAccessProfile($this->access);
|
|
|
}
|
|
|
@@ -316,8 +323,10 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$this->access->method('getBillingPayers')->willReturn($this->nonEmptyCollection);
|
|
|
$this->access->method('getBillingReceivers')->willReturn($this->emptyCollection);
|
|
|
$this->access->method('getAccessIntangibles')->willReturn($this->emptyCollection);
|
|
|
+ $this->access->method('getPreferences')->willReturn($this->preferences);
|
|
|
|
|
|
$this->accessProfile->expects(self::once())->method('setIsPayor')->with(true)->willReturnSelf();
|
|
|
+ $this->preferences->expects(self::once())->method('getId')->willReturn(1);
|
|
|
|
|
|
$this->accessProfileCreator->createCompleteAccessProfile($this->access);
|
|
|
}
|
|
|
@@ -335,8 +344,10 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$this->access->method('getBillingPayers')->willReturn($this->emptyCollection);
|
|
|
$this->access->method('getBillingReceivers')->willReturn($this->emptyCollection);
|
|
|
$this->access->method('getAccessIntangibles')->willReturn($this->nonEmptyCollection);
|
|
|
+ $this->access->method('getPreferences')->willReturn($this->preferences);
|
|
|
|
|
|
$this->accessProfile->expects(self::once())->method('setIsPayor')->with(true)->willReturnSelf();
|
|
|
+ $this->preferences->expects(self::once())->method('getId')->willReturn(1);
|
|
|
|
|
|
$this->accessProfileCreator->createCompleteAccessProfile($this->access);
|
|
|
}
|
|
|
@@ -354,8 +365,10 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$this->access->method('getBillingPayers')->willReturn($this->emptyCollection);
|
|
|
$this->access->method('getBillingReceivers')->willReturn($this->emptyCollection);
|
|
|
$this->access->method('getAccessIntangibles')->willReturn($this->nonEmptyCollection);
|
|
|
+ $this->access->method('getPreferences')->willReturn($this->preferences);
|
|
|
|
|
|
$this->accessProfile->expects(self::once())->method('setIsPayor')->with(false)->willReturnSelf();
|
|
|
+ $this->preferences->expects(self::once())->method('getId')->willReturn(1);
|
|
|
|
|
|
$this->accessProfileCreator->createCompleteAccessProfile($this->access);
|
|
|
}
|
|
|
@@ -380,13 +393,9 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$person->expects(self::once())->method('getGender')->willReturn(GenderEnum::MISTER);
|
|
|
$person->expects(self::once())->method('getImage')->willReturn($image);
|
|
|
|
|
|
- $preferences = $this->getMockBuilder(Preferences::class)->getMock();
|
|
|
- $preferences->expects(self::once())->method('getId')->willReturn(1);
|
|
|
-
|
|
|
$this->access->expects(self::once())->method('getId')->willReturn(1);
|
|
|
$this->access->method('getOrganization')->willReturn($this->organization);
|
|
|
$this->access->method('getPerson')->willReturn($person);
|
|
|
- $this->access->expects(self::once())->method('getPreferences')->willReturn($preferences);
|
|
|
$this->access->expects(self::once())->method('getActivityYear')->willReturn(2020);
|
|
|
$this->access->expects(self::once())->method('getSuperAdminAccess')->willReturn(false);
|
|
|
|
|
|
@@ -406,7 +415,6 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$this->assertEquals(123, $accessProfile->getAvatarId());
|
|
|
$this->assertFalse($accessProfile->getIsSuperAdminAccess());
|
|
|
$this->assertEquals($this->organizationProfile, $accessProfile->getOrganization());
|
|
|
- $this->assertEquals(1, $accessProfile->getPreferencesId());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -421,7 +429,7 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
->getMock();
|
|
|
|
|
|
$this->access->expects(self::once())->method('setPreferences');
|
|
|
- $this->entityManager->expects(self::once())->method('flush')->with($this->access);
|
|
|
+ $this->entityManager->expects(self::once())->method('flush');
|
|
|
|
|
|
$accessProfileCreator->createPreferences($this->access);
|
|
|
}
|