Skip to content

Commit

Permalink
CC-1496 fix testFindActiveCompanyUsersByCustomerId
Browse files Browse the repository at this point in the history
  • Loading branch information
Evhen Odokienko committed Nov 7, 2018
1 parent 9fc2ee9 commit 09c2bac
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Generated\Shared\Transfer\CompanyUserCollectionTransfer;
use Generated\Shared\Transfer\CompanyUserTransfer;
use Generated\Shared\Transfer\CustomerTransfer;
use Orm\Zed\Company\Persistence\Map\SpyCompanyTableMap;
use Spryker\Zed\CompanyUser\Business\CompanyUserFacadeInterface;

/**
Expand Down Expand Up @@ -103,19 +104,22 @@ public function testFindActiveCompanyUsersByCustomerId(): void
{
//Arrange
$expectedCompanyUserAmount = 1;
$activeCompany = $this->tester->haveActiveCompany();
$inactiveCompany = $this->tester->haveInactiveCompany();

$seedDataWithActiveCompany = [
CompanyUserTransfer::FK_COMPANY => $activeCompany->getIdCompany(),
CompanyUserTransfer::CUSTOMER => $this->customer,
];
$seedDataWithInactiveCompany = [
CompanyUserTransfer::FK_COMPANY => $inactiveCompany->getIdCompany(),
CompanyUserTransfer::CUSTOMER => $this->customer,
$activeness = [true, false];
$statuses = [
SpyCompanyTableMap::COL_STATUS_APPROVED,
SpyCompanyTableMap::COL_STATUS_PENDING,
SpyCompanyTableMap::COL_STATUS_DENIED,
];
$this->tester->haveCompanyUser($seedDataWithActiveCompany);
$this->tester->haveCompanyUser($seedDataWithInactiveCompany);

foreach ($activeness as $isActive) {
foreach ($statuses as $status) {
$company = $this->tester->haveCompany(['isActive' => $isActive, 'status' => $status]);
$this->tester->haveCompanyUser([
CompanyUserTransfer::FK_COMPANY => $company->getIdCompany(),
CompanyUserTransfer::CUSTOMER => $this->customer,
]);
}
}

//Act
$actualCompanyUserCollection = $this->tester->getFacade()->findActiveCompanyUsersByCustomerId($this->customer);
Expand Down

0 comments on commit 09c2bac

Please sign in to comment.