Skip to content
Snippets Groups Projects
Commit e01cfe4e authored by Laurent's avatar Laurent
Browse files

rd #14085 pnb

parses availability time
parent 5d9a17e1
Branches
Tags
6 merge requests!780Master,!767Master,!764Dev#21988 consultation pnb,!753Dev#21988 consultation pnb,!744Dev #21987 register ip pnb,!733Rd #14085 pnb
......@@ -23,7 +23,8 @@
class Class_Album_UsageConstraint extends Storm_Model_Abstract {
const
DEVICE_SHARE_CONSTRAINT = '04',
LOAN_CONSTRAINT = '06';
LOAN_CONSTRAINT = '06',
AVAILABILITY_CONSTRAINT = '07';
protected
$_table_name = 'album_usage_constraints',
......@@ -42,6 +43,11 @@ class Class_Album_UsageConstraint extends Storm_Model_Abstract {
}
public function isAvailabilityConstraint() {
return $this->getUsageType() == self::AVAILABILITY_CONSTRAINT;
}
public function getDatas() {
if (!isset($this->_datas))
$this->_datas = (new Class_JSONSerializedDatas($this->getSerializedDatas()));
......
......@@ -39,6 +39,11 @@ class Class_Album_UsageConstraints extends Storm_Model_Collection_Abstract {
public function getLoanQuantity() {
return $this->getLoanConstraint()->getQuantity();
}
public function getAvailabilityDuration() {
return $this->detect(function($c) {return $c->isAvailabilityConstraint();})->getDuration();
}
}
?>
\ No newline at end of file
......@@ -113,6 +113,15 @@ class DilicomPNBOfferParserTest extends Storm_Test_ModelTestCase {
}
/**
* @depends firstAlbumShouldBePlusJamaisSansElle
* @test
*/
public function firstAlbumAvailabilityDurationShouldBe1825($album) {
$this->assertEquals(1825, $album->getUsageConstraints()->getAvailabilityDuration());
}
/**
* @depends firstAlbumShouldBePlusJamaisSansElle
* @test
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment