CFDBIntegrationCalderaFormsTest

The Contact Form DB CFDBIntegrationCalderaFormsTest class.

Defined (1)

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

/phpunit/CFDBIntegrationCalderaFormsTest.php  
  1. class CFDBIntegrationCalderaFormsTest extends PHPUnit_Framework_TestCase { 
  2.  
  3. public function testSubmission() { 
  4.  
  5. $form_ser = file_get_contents('CFDBIntegrationCalderaFormsTest/form.dat'); 
  6. $referrer_ser = file_get_contents('CFDBIntegrationCalderaFormsTest/referrer.dat'); 
  7. $processed_data_ser = file_get_contents('CFDBIntegrationCalderaFormsTest/processed_data.dat'); 
  8.  
  9. $form = unserialize($form_ser); 
  10. $referrer = unserialize($referrer_ser); 
  11. global $processed_data; 
  12. $processed_data = unserialize($processed_data_ser); 
  13.  
  14. $caldera = new CFDBIntegrationCalderaForms(null); 
  15. $data = $caldera->convertData($form); 
  16.  
  17. $this->assertEquals("Caldera Form 1", $data->title); 
  18. $this->assertEquals('click', $data->posted_data['mybutton']); 
  19. $this->assertEquals('good, bad, ugly', $data->posted_data['mycheckbox']); 
  20. $this->assertEquals('red', $data->posted_data['mydropdown']); 
  21. $this->assertEquals('no_one@nowhere.com', $data->posted_data['email']); 
  22. $this->assertEquals('my hidden value', $data->posted_data['myhidden']); 
  23. $this->assertEquals("line1\nline2\nline3", $data->posted_data['text']); 
  24. $this->assertEquals('(123)456-7890', $data->posted_data['phone']); 
  25. $this->assertEquals('far', $data->posted_data['howfar']); 
  26. $this->assertEquals('VA', $data->posted_data['state']); 
  27. $this->assertEquals('hello', $data->posted_data['line']); 
  28. $this->assertEquals('#786161', $data->posted_data['color']); 
  29. $this->assertEquals('73', $data->posted_data['range']); 
  30.  
  31. $this->assertEquals('Screen-Shot.png', $data->posted_data['file']); 
  32. $this->assertEquals('/var/www/htdocs//wp-content/uploads/2015/05/Screen-Shot.png', $data->uploaded_files['file']); 
  33.  
  34.  
  35. public function test_getUrlWithoutSchemeHostAndPort_1() { 
  36. $caldera = new CFDBIntegrationCalderaForms(null); 
  37. $this->assertEquals('/wp-content/uploads/2015/05/Screen-Shot.png',  
  38. $caldera->getUrlWithoutSchemeHostAndPort('http://www.mysite.com/wp-content/uploads/2015/05/Screen-Shot.png')); 
  39.  
  40. public function test_getUrlWithoutSchemeHostAndPort_2() { 
  41. $caldera = new CFDBIntegrationCalderaForms(null); 
  42. $this->assertEquals('/wp-content/uploads/2015/05/Screen-Shot.png',  
  43. $caldera->getUrlWithoutSchemeHostAndPort('https://www.mysite.com/wp-content/uploads/2015/05/Screen-Shot.png')); 
  44.  
  45. public function test_getUrlWithoutSchemeHostAndPort_3() { 
  46. $caldera = new CFDBIntegrationCalderaForms(null); 
  47. $this->assertEquals('/wp-content/uploads/2015/05/Screen-Shot.png',  
  48. $caldera->getUrlWithoutSchemeHostAndPort('https://www.mysite.com:8080/wp-content/uploads/2015/05/Screen-Shot.png')); 
  49.