Skip to content

Commit

Permalink
doc blocks for test functions
Browse files Browse the repository at this point in the history
  • Loading branch information
AD7six committed Nov 14, 2014
1 parent 3feeed3 commit 404c16a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/TestCase/View/BakeViewTest.php
Expand Up @@ -48,6 +48,11 @@ public function tearDown() {
unset($this->View);
}

/**
* test rendering a string
*
* @return void
*/
public function testRenderString() {
$template = 'The value of aVariable is: <%= $aVariable %>.';

Expand All @@ -58,6 +63,11 @@ public function testRenderString() {
$this->assertSame($expected, $result, 'variables in erb-style tags should be evaluated');
}

/**
* test rendering a template file
*
* @return void
*/
public function testRenderTemplate() {
$this->View->set(['aVariable' => 123]);
$result = $this->View->render('view_tests/simple');
Expand All @@ -66,6 +76,11 @@ public function testRenderTemplate() {
$this->assertSame($expected, $result, 'variables in erb-style tags should be evaluated');
}

/**
* verify that php tags are ignored
*
* @return void
*/
public function testRenderIgnorePhpTags() {
$template = 'The value of aVariable is: <%= $aVariable %>. Not <?php echo $aVariable ?>.';

Expand All @@ -76,6 +91,11 @@ public function testRenderIgnorePhpTags() {
$this->assertSame($expected, $result, 'variables in php tags should be treated as strings');
}

/**
* verify that short php tags are ignored
*
* @return void
*/
public function testRenderIgnorePhpShortTags() {
$template = 'The value of aVariable is: <%= $aVariable %>. Not <?= $aVariable ?>.';

Expand All @@ -86,6 +106,11 @@ public function testRenderIgnorePhpShortTags() {
$this->assertSame($expected, $result, 'variables in php tags should be treated as strings');
}

/**
* Newlines after template tags should act predictably
*
* @return void
*/
public function testRenderNewlines() {
$result = $this->View->render('view_tests/newlines');
$expected = "There should be a newline about here: \n";
Expand All @@ -100,6 +125,11 @@ public function testRenderNewlines() {
);
}

/**
* Verify that template tags with leading whitespace don't leave a mess
*
* @return void
*/
public function testSwallowLeadingWhitespace() {
$result = $this->View->render('view_tests/leading-whitespace');
$expected = $this->_getCompareTemplate('leading-whitespace');
Expand Down

0 comments on commit 404c16a

Please sign in to comment.