public function testVoucherGroupValidateSucessful() { $aGroup = new VoucherGroup(); $sName = 'Sales Vouchers'; $iID = 1; $bDisabled = false; $iSort = 100; $oCreated = new DateTime(); $sSlugName = 'sales_vouchers'; //$sSlugName = ''; $aGroup->setVoucherGroupID($iID); $aGroup->setDisabledStatus($bDisabled); $aGroup->setVoucherGroupName($sName); $aGroup->setSortOrder($iSort); $aGroup->setDateCreated($oCreated); $aGroup->setSlugName($sSlugName); $this->assertTrue($aGroup->validate()); // test valid without ID (need create) $aGroup = new VoucherGroup(); $sName = 'Sales Vouchers'; $bDisabled = false; $iSort = 100; $oCreated = new DateTime(); $sSlugName = 'sales_vouchers'; $aGroup->setDisabledStatus($bDisabled); $aGroup->setVoucherGroupName($sName); $aGroup->setSortOrder($iSort); $aGroup->setDateCreated($oCreated); $aGroup->setSlugName($sSlugName); $this->assertTrue($aGroup->validate()); }
/** * 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; }
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)); }