Skip to content

Commit

Permalink
fixing the unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Henri Ylikotila committed Dec 19, 2017
1 parent f424cd6 commit 632169a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/ConceptPropertyValueLiteralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ protected function setUp() {
*/
public function testConstructor() {
$litmock = $this->getMockBuilder('EasyRdf\Literal')->disableOriginalConstructor()->getMock();
$prop = new ConceptPropertyValueLiteral($litmock, 'skosmos:someProperty');
$resmock = $this->getMockBuilder('EasyRdf\Resource')->disableOriginalConstructor()->getMock();
$prop = new ConceptPropertyValueLiteral($this->model, $this->vocab, $resmock, $litmock, 'skosmos:someProperty');
$this->assertEquals(null, $prop->__toString());
}

Expand Down Expand Up @@ -101,7 +102,8 @@ public function testToString() {
*/
public function testToStringEmpty() {
$litmock = $this->getMockBuilder('EasyRdf\Literal')->disableOriginalConstructor()->getMock();
$lit = new ConceptPropertyValueLiteral($litmock, 'skosmos:testType');
$resmock = $this->getMockBuilder('EasyRdf\Resource')->disableOriginalConstructor()->getMock();
$lit = new ConceptPropertyValueLiteral($this->model, $this->vocab, $resmock, $litmock, 'skosmos:testType');
$this->assertEquals('', $lit);
}

Expand All @@ -110,7 +112,8 @@ public function testToStringEmpty() {
*/
public function testGetNotation() {
$litmock = $this->getMockBuilder('EasyRdf\Literal')->disableOriginalConstructor()->getMock();
$lit = new ConceptPropertyValueLiteral($litmock, 'skosmos:testType');
$resmock = $this->getMockBuilder('EasyRdf\Resource')->disableOriginalConstructor()->getMock();
$lit = new ConceptPropertyValueLiteral($this->model, $this->vocab, $resmock, $litmock, 'skosmos:testType');
$this->assertEquals(null, $lit->getNotation());
}

Expand All @@ -120,7 +123,8 @@ public function testGetNotation() {
public function testGetContainsHtmlWhenThereIsNone() {
$litmock = $this->getMockBuilder('EasyRdf\Literal')->disableOriginalConstructor()->getMock();
$litmock->method('getValue')->will($this->returnValue('a regular literal'));
$lit = new ConceptPropertyValueLiteral($litmock, 'skosmos:testType');
$resmock = $this->getMockBuilder('EasyRdf\Resource')->disableOriginalConstructor()->getMock();
$lit = new ConceptPropertyValueLiteral($this->model, $this->vocab, $resmock, $litmock, 'skosmos:testType');
$this->assertFalse($lit->getContainsHtml());
}

Expand All @@ -130,7 +134,8 @@ public function testGetContainsHtmlWhenThereIsNone() {
public function testGetContainsHtmlWhenThereIsOnlyAOpeningTag() {
$litmock = $this->getMockBuilder('EasyRdf\Literal')->disableOriginalConstructor()->getMock();
$litmock->method('getValue')->will($this->returnValue('a <a href=\"http://skosmos.org\"> literal with broken html'));
$lit = new ConceptPropertyValueLiteral($litmock, 'skosmos:testType');
$resmock = $this->getMockBuilder('EasyRdf\Resource')->disableOriginalConstructor()->getMock();
$lit = new ConceptPropertyValueLiteral($this->model, $this->vocab, $resmock, $litmock, 'skosmos:testType');
$this->assertFalse($lit->getContainsHtml());
}

Expand All @@ -140,7 +145,8 @@ public function testGetContainsHtmlWhenThereIsOnlyAOpeningTag() {
public function testGetContainsHtml() {
$litmock = $this->getMockBuilder('EasyRdf\Literal')->disableOriginalConstructor()->getMock();
$litmock->method('getValue')->will($this->returnValue('a <a href=\"http://skosmos.org\">literal</a> with valid html'));
$lit = new ConceptPropertyValueLiteral($litmock, 'skosmos:testType');
$resmock = $this->getMockBuilder('EasyRdf\Resource')->disableOriginalConstructor()->getMock();
$lit = new ConceptPropertyValueLiteral($this->model, $this->vocab, $resmock, $litmock, 'skosmos:testType');
$this->assertTrue($lit->getContainsHtml());
}
}

0 comments on commit 632169a

Please sign in to comment.