HtmlTemplateMissingFieldTest

The Contact Form DB HtmlTemplateMissingFieldTest class.

Defined (1)

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

/phpunit/HtmlTemplateMissingFieldTest.php  
  1. class HtmlTemplateMissingFieldTest extends PHPUnit_Framework_TestCase { 
  2.  
  3. public function setUp() { 
  4. date_default_timezone_set('America/New_York'); 
  5. $str = file_get_contents('HtmlTemplateMissingFieldTest.json'); 
  6. $data = json_decode($str, true); 
  7. $mock = new MockQueryResultIterator($data); 
  8. CFDBQueryResultIteratorFactory::getInstance()->setQueryResultsIteratorMock($mock); 
  9.  
  10. global $wpdb; 
  11. $wpdb = new WPDB_Mock; 
  12.  
  13. $fields = array(); 
  14. foreach (array_keys($data[0]) as $key) { 
  15. $fields[] = (object)array('field_name' => $key); 
  16. $wpdb->getResultReturnVal = $fields; 
  17.  
  18. public function test_missing_lname_field() { 
  19. $options = array(); 
  20. $options['content'] = '${fname} ${lname} | '; 
  21.  
  22. $exp = new ExportToHtmlTemplate(); 
  23. ob_start(); 
  24. $exp->export('dates', $options); 
  25. $text = ob_get_contents(); 
  26.  
  27. $this->assertEquals("Mike Simpson | Oya | ", $text); 
  28.