CFDBShortCodeContentParserTest

The Contact Form DB CFDBShortCodeContentParserTest class.

Defined (1)

The class is defined in the following location(s).

/phpunit/CFDBShortCodeContentParserTest.php  
  1. class CFDBShortCodeContentParserTest extends PHPUnit_Framework_TestCase { 
  2.  
  3. public function test_parseHeaderTemplateFooter_no_header_no_footer() { 
  4. $parser = new CFDBShortCodeContentParser(); 
  5. $content = 'Name: ${fname} ${lname}'; 
  6.  
  7. $header = null; 
  8. $template = null; 
  9. $footer = null; 
  10. list($header, $template, $footer) = $parser->parseBeforeContentAfter($content); 
  11.  
  12. $this->assertEquals(null, $header); 
  13. $this->assertEquals($content, $template); 
  14. $this->assertEquals(null, $footer); 
  15.  
  16. public function test_parseHeaderTemplateFooter_header_no_footer() { 
  17. $parser = new CFDBShortCodeContentParser(); 
  18. $content = '{{BEFORE}}This is my header{{/BEFORE}}Name: ${fname} ${lname}'; 
  19.  
  20. $header = null; 
  21. $template = null; 
  22. $footer = null; 
  23. list($header, $template, $footer) = $parser->parseBeforeContentAfter($content); 
  24.  
  25. $this->assertEquals('This is my header', $header); 
  26. $this->assertEquals('Name: ${fname} ${lname}', $template); 
  27. $this->assertEquals(null, $footer); 
  28.  
  29. public function test_parseHeaderTemplateFooter_no_header_footer() { 
  30. $parser = new CFDBShortCodeContentParser(); 
  31. $content = 'Name: ${fname} ${lname}{{AFTER}}This is my footer{{/AFTER}}'; 
  32.  
  33. $header = null; 
  34. $template = null; 
  35. $footer = null; 
  36. list($header, $template, $footer) = $parser->parseBeforeContentAfter($content); 
  37.  
  38. $this->assertEquals(null, $header); 
  39. $this->assertEquals('Name: ${fname} ${lname}', $template); 
  40. $this->assertEquals('This is my footer', $footer); 
  41.  
  42. public function test_parseHeaderTemplateFooter_header_footer() { 
  43. $parser = new CFDBShortCodeContentParser(); 
  44. $content = '{{BEFORE}}This is my header{{/BEFORE}}Name: ${fname} ${lname}{{AFTER}}This is my footer{{/AFTER}}'; 
  45.  
  46. $header = null; 
  47. $template = null; 
  48. $footer = null; 
  49. list($header, $template, $footer) = $parser->parseBeforeContentAfter($content); 
  50.  
  51. $this->assertEquals('This is my header', $header); 
  52. $this->assertEquals('Name: ${fname} ${lname}', $template); 
  53. $this->assertEquals('This is my footer', $footer); 
  54.