Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
Merge pull request #179 from ministryofjustice/SDV-61_Crec
Browse files Browse the repository at this point in the history
Sdv 61 crec
  • Loading branch information
jeremyquinton committed Feb 13, 2015
2 parents 41db328 + 83325f9 commit 0c2603c
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/Opg/Core/Model/Entity/Document/Crec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace Opg\Core\Model\Entity\Document;

use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Exclude;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\ReadOnly;
use Opg\Core\Model\Entity\Document\Decorators\SystemType;
use Opg\Core\Model\Entity\Document\Decorators\HasSystemType;

/**
* @ORM\Entity
* ORM\entity(repositoryClass="Application\Model\Repository\DocumentRepository")
*
* Class Correspondence
* @package Opg\Core\Model\Entity\Document
*/
class Crec extends Document implements HasSystemType
{
use SystemType;

/**
* @Type("string")
* @Accessor(getter="getDirection")
* @ReadOnly
*/
protected $direction = self::DOCUMENT_INTERNAL_CORRESPONDENCE;

/**
* @ORM\Column(type="integer", nullable=true)
* @Type("integer")
* @var int
*/
protected $riskScore;

/**
* @return int
*/
public function getRiskScore()
{
return $this->riskScore;
}

/**
* @param int $riskScore
*
* @return $this
*/
public function setRiskScore($riskScore)
{
$this->riskScore = intval($riskScore);

return $this;
}

}
1 change: 1 addition & 0 deletions src/Opg/Core/Model/Entity/Document/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* "lodging_checklist" = "Opg\Core\Model\Entity\Document\LodgingChecklist",
* "action_log" = "Opg\Core\Model\Entity\Document\ActionLog",
* "annual_report" = "Opg\Core\Model\Entity\Document\AnnualReport",
* "crec" = "Opg\Core\Model\Entity\Document\Crec"
* })
*
* Class Document
Expand Down
31 changes: 31 additions & 0 deletions tests/OpgTest/Core/Model/Entity/Document/CrecTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace OpgTest\Core\Model\Entity\Document;

use Opg\Core\Model\Entity\Document\Crec;

class CrecTest extends \PHPUnit_Framework_TestCase
{
/** @var Crec */
protected $crec;

public function setUp()
{
$this->crec = new Crec();
}

public function testSetUp()
{
$this->assertTrue($this->crec instanceof Crec);
}

public function testGetSetTotalAssets()
{
$expected = 42;

$this->assertEmpty($this->crec->getRiskScore());
$this->assertTrue($this->crec->setRiskScore($expected) instanceof Crec);

$this->assertEquals($expected, $this->crec->getRiskScore());
}
}

0 comments on commit 0c2603c

Please sign in to comment.