Skip to content

Commit

Permalink
Datatype unit-tests (#1146)
Browse files Browse the repository at this point in the history
* Unit tests for DataType class
  • Loading branch information
kenguest authored and siad007 committed Oct 5, 2019
1 parent 0f28ca3 commit ccc575a
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions test/classes/phing/types/DataTypeTest.php
@@ -0,0 +1,51 @@
<?php
class DataTypeTest extends \PHPUnit\Framework\TestCase
{
protected function setUp(): void
{
$this->datatype = new DataType();
}

/**
* testTooManyAttributes
*
* @expectedException BuildException
* @expectedExceptionMessage You must not specify more than one attribute when using refid
*/
public function testTooManyAttributes()
{
$ex = $this->datatype->tooManyAttributes();
throw $ex;
}

/**
* testNoChildrenAllowedException
*
* @expectedException BuildException
* @expectedExceptionMessage You must not specify nested elements when using refid
*/
public function testNoChildrenAllowedException()
{
$ex = $this->datatype->noChildrenAllowed();
throw $ex;
}

/**
* testCircularReferenceException
*
* @expectedException BuildException
* @expectedExceptionMessage This data type contains a circular reference.
*/
public function testCircularReferenceException()
{
$ex = $this->datatype->circularReference();
throw $ex;
}

public function testToString()
{
$str = "";
$str .= $this->datatype;
$this->assertEquals("DataType", $str);
}
}

0 comments on commit ccc575a

Please sign in to comment.