コード例 #1
0
 /**
  *  Convert data array into entity
  *
  *  @return VoucherGroup
  *  @param array $data
  *  @access public
  */
 public function build($data)
 {
     $oEntity = new VoucherGroup();
     $sAlias = $this->getTableQueryAlias();
     $iVoucherGroupId = $this->getField($data, 'voucher_group_id', $sAlias);
     $sVoucherGroupName = $this->getField($data, 'voucher_group_name', $sAlias);
     $sVoucheGroupSlug = $this->getField($data, 'voucher_group_slug', $sAlias);
     $bIsDisabled = $this->getField($data, 'is_disabled', $sAlias);
     $iSortOrder = $this->getField($data, 'sort_order', $sAlias);
     $oDateCreated = $this->getField($data, 'date_created', $sAlias);
     $oEntity->setVoucherGroupId($iVoucherGroupId);
     $oEntity->setVoucherGroupName($sVoucherGroupName);
     $oEntity->setSlugName($sVoucheGroupSlug);
     $oEntity->setDisabledStatus($bIsDisabled);
     $oEntity->setSortOrder($iSortOrder);
     $oEntity->setDateCreated($oDateCreated);
     return $oEntity;
 }
コード例 #2
0
 public function testVoucherGroupValidateFails()
 {
     $aGroup = new VoucherGroup();
     $sName = '';
     $iID = null;
     $bDisabled = null;
     $iSort = 100;
     $oCreated = new DateTime();
     $sSlugName = '';
     $aGroup->setVoucherGroupID($iID);
     //$aGroup->setDisabledStatus($bDisabled);
     $aGroup->setVoucherGroupName($sName);
     $aGroup->setSortOrder($iSort);
     $aGroup->setDateCreated($oCreated);
     $aGroup->setSlugName($sSlugName);
     $aValidateErrors = $aGroup->validate();
     $this->assertEquals(count($aValidateErrors['slugName']), 3);
     $this->assertEquals(count($aValidateErrors['name']), 2);
     $this->assertEquals(count($aValidateErrors['isDisabled']), 1);
     $this->assertEquals(count($aValidateErrors['voucherID']), 1);
 }
コード例 #3
0
 public function testVoucherGroupRevise()
 {
     $oContainer = $this->getContainer();
     $aOperations = $oContainer->getVoucherGroupOperations();
     $oReviseOperation = $aOperations['update'];
     # assert correct operation was returned
     $this->assertInstanceOf('\\IComeFromTheNet\\Ledger\\Voucher\\Operations\\GroupRevise', $oReviseOperation);
     $oGroup = new VoucherGroup();
     $sName = 'Sales Vouchers Next';
     $iID = 1;
     $bDisabled = false;
     $iSort = 100;
     $oCreated = new DateTime();
     $sSlugName = 'sales_vouchers_next';
     $oGroup->setVoucherGroupId($iID);
     $oGroup->setDisabledStatus($bDisabled);
     $oGroup->setVoucherGroupName($sName);
     $oGroup->setSortOrder($iSort);
     $oGroup->setDateCreated($oCreated);
     $oGroup->setSlugName($sSlugName);
     $this->assertTrue($oReviseOperation->execute($oGroup));
 }