|
@@ -5,7 +5,7 @@ namespace App\Tests\Unit\Service\Access;
|
|
|
use App\ApiResources\Profile\AccessProfile;
|
|
use App\ApiResources\Profile\AccessProfile;
|
|
|
use App\ApiResources\Profile\OrganizationProfile;
|
|
use App\ApiResources\Profile\OrganizationProfile;
|
|
|
use App\Entity\Access\Access;
|
|
use App\Entity\Access\Access;
|
|
|
-use App\Entity\Access\AccessPreference;
|
|
|
|
|
|
|
+use App\Entity\Access\Preferences;
|
|
|
use App\Entity\Core\File;
|
|
use App\Entity\Core\File;
|
|
|
use App\Entity\Organization\Organization;
|
|
use App\Entity\Organization\Organization;
|
|
|
use App\Entity\Person\Person;
|
|
use App\Entity\Person\Person;
|
|
@@ -28,7 +28,6 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
private MockObject|AccessUtils $accessUtils;
|
|
private MockObject|AccessUtils $accessUtils;
|
|
|
private MockObject|AccessProfileCreator $accessProfileCreator;
|
|
private MockObject|AccessProfileCreator $accessProfileCreator;
|
|
|
private MockObject|AccessProfile $accessProfile;
|
|
private MockObject|AccessProfile $accessProfile;
|
|
|
- private MockObject|AccessPreference $accessPreference;
|
|
|
|
|
private MockObject|Collection $emptyCollection;
|
|
private MockObject|Collection $emptyCollection;
|
|
|
private MockObject|Collection $nonEmptyCollection;
|
|
private MockObject|Collection $nonEmptyCollection;
|
|
|
private MockObject|Organization $organization;
|
|
private MockObject|Organization $organization;
|
|
@@ -53,7 +52,6 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$this->access = $this->getMockBuilder(Access::class)->getMock();
|
|
$this->access = $this->getMockBuilder(Access::class)->getMock();
|
|
|
$this->organizationProfile = $this->getMockBuilder(OrganizationProfile::class)->getMock();
|
|
$this->organizationProfile = $this->getMockBuilder(OrganizationProfile::class)->getMock();
|
|
|
$this->accessProfile = $this->getMockBuilder(AccessProfile::class)->getMock();
|
|
$this->accessProfile = $this->getMockBuilder(AccessProfile::class)->getMock();
|
|
|
- $this->accessPreference = $this->getMockBuilder(AccessPreference::class)->getMock();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -106,7 +104,7 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
// create the profile
|
|
// create the profile
|
|
|
$accessProfileCreator
|
|
$accessProfileCreator
|
|
|
->expects(self::once())
|
|
->expects(self::once())
|
|
|
- ->method('createAccessPrefence')
|
|
|
|
|
|
|
+ ->method('createPreferences')
|
|
|
->with($this->access);
|
|
->with($this->access);
|
|
|
|
|
|
|
|
// create the profile
|
|
// create the profile
|
|
@@ -382,13 +380,13 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$person->expects(self::once())->method('getGender')->willReturn(GenderEnum::MISTER);
|
|
$person->expects(self::once())->method('getGender')->willReturn(GenderEnum::MISTER);
|
|
|
$person->expects(self::once())->method('getImage')->willReturn($image);
|
|
$person->expects(self::once())->method('getImage')->willReturn($image);
|
|
|
|
|
|
|
|
- $accessPreference = $this->getMockBuilder(AccessPreference::class)->getMock();
|
|
|
|
|
- $accessPreference->expects(self::once())->method('getId')->willReturn(1);
|
|
|
|
|
|
|
+ $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->expects(self::once())->method('getId')->willReturn(1);
|
|
|
$this->access->method('getOrganization')->willReturn($this->organization);
|
|
$this->access->method('getOrganization')->willReturn($this->organization);
|
|
|
$this->access->method('getPerson')->willReturn($person);
|
|
$this->access->method('getPerson')->willReturn($person);
|
|
|
- $this->access->expects(self::once())->method('getPreferences')->willReturn($accessPreference);
|
|
|
|
|
|
|
+ $this->access->expects(self::once())->method('getPreferences')->willReturn($preferences);
|
|
|
$this->access->expects(self::once())->method('getActivityYear')->willReturn(2020);
|
|
$this->access->expects(self::once())->method('getActivityYear')->willReturn(2020);
|
|
|
$this->access->expects(self::once())->method('getSuperAdminAccess')->willReturn(false);
|
|
$this->access->expects(self::once())->method('getSuperAdminAccess')->willReturn(false);
|
|
|
|
|
|
|
@@ -408,25 +406,23 @@ class AccessProfileCreatorTest extends TestCase
|
|
|
$this->assertEquals(123, $accessProfile->getAvatarId());
|
|
$this->assertEquals(123, $accessProfile->getAvatarId());
|
|
|
$this->assertFalse($accessProfile->getIsSuperAdminAccess());
|
|
$this->assertFalse($accessProfile->getIsSuperAdminAccess());
|
|
|
$this->assertEquals($this->organizationProfile, $accessProfile->getOrganization());
|
|
$this->assertEquals($this->organizationProfile, $accessProfile->getOrganization());
|
|
|
- $this->assertEquals(1, $accessProfile->getAccessPreferenceId());
|
|
|
|
|
|
|
+ $this->assertEquals(1, $accessProfile->getPreferencesId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * If the access has no billingPayers, has AccessIntangible but also have children, isPayor shall be set to false.
|
|
|
|
|
- *
|
|
|
|
|
- * @see AccessProfileCreator::createAccessPrefence()
|
|
|
|
|
|
|
+ * @see AccessProfileCreator::createPreferences()
|
|
|
*/
|
|
*/
|
|
|
- public function testCreateAccessPreference(): void
|
|
|
|
|
|
|
+ public function testCreatePreferences(): void
|
|
|
{
|
|
{
|
|
|
$accessProfileCreator = $this
|
|
$accessProfileCreator = $this
|
|
|
->getMockBuilder(AccessProfileCreator::class)
|
|
->getMockBuilder(AccessProfileCreator::class)
|
|
|
->setConstructorArgs([$this->organizationProfileCreator, $this->accessRepository, $this->accessUtils, $this->entityManager])
|
|
->setConstructorArgs([$this->organizationProfileCreator, $this->accessRepository, $this->accessUtils, $this->entityManager])
|
|
|
- ->setMethodsExcept(['createAccessPrefence'])
|
|
|
|
|
|
|
+ ->setMethodsExcept(['createPreferences'])
|
|
|
->getMock();
|
|
->getMock();
|
|
|
|
|
|
|
|
$this->access->expects(self::once())->method('setPreferences');
|
|
$this->access->expects(self::once())->method('setPreferences');
|
|
|
$this->entityManager->expects(self::once())->method('flush')->with($this->access);
|
|
$this->entityManager->expects(self::once())->method('flush')->with($this->access);
|
|
|
|
|
|
|
|
- $accessProfileCreator->createAccessPrefence($this->access);
|
|
|
|
|
|
|
+ $accessProfileCreator->createPreferences($this->access);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|