Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...) http://blog.slucas.fr/en/oss/calibre-opds-php-server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.0KB

  1. <?php
  2. /**
  3. * COPS (Calibre OPDS PHP Server) test file
  4. *
  5. * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
  6. * @author Sébastien Lucas <sebastien@slucas.fr>
  7. */
  8. require_once (dirname(__FILE__) . "/config_test.php");
  9. require_once (dirname(__FILE__) . "/../book.php");
  10. require_once (dirname(__FILE__) . "/../sendtomail.php");
  11. class MailTest extends PHPUnit_Framework_TestCase
  12. {
  13. public function testCheckConfigurationOk () {
  14. global $config;
  15. $this->assertFalse(checkConfiguration ());
  16. }
  17. public function testCheckConfigurationNull () {
  18. global $config;
  19. $config['cops_mail_configuration'] = NULL;
  20. $this->assertStringStartsWith("NOK", checkConfiguration ());
  21. }
  22. public function testCheckConfigurationNotArray () {
  23. global $config;
  24. $config['cops_mail_configuration'] = "Test";
  25. $this->assertStringStartsWith("NOK", checkConfiguration ());
  26. }
  27. public function testCheckConfigurationSmtpEmpty () {
  28. global $config;
  29. $config['cops_mail_configuration']["smtp.host"] = "";
  30. $this->assertStringStartsWith("NOK", checkConfiguration ());
  31. }
  32. public function testCheckConfigurationEmailEmpty () {
  33. global $config;
  34. $config['cops_mail_configuration']["address.from"] = "";
  35. $this->assertStringStartsWith("NOK", checkConfiguration ());
  36. }
  37. public function testCheckConfigurationEmailNotValid () {
  38. global $config;
  39. $config['cops_mail_configuration']["address.from"] = "a";
  40. $this->markTestIncomplete();
  41. }
  42. public function testCheckRequest () {
  43. $this->assertFalse (checkRequest (12, "a@a.com"));
  44. }
  45. public function testCheckRequestNoData () {
  46. $this->assertStringStartsWith ("No", checkRequest (NULL, "a@a.com"));
  47. }
  48. public function testCheckRequestNoEmail () {
  49. $this->assertStringStartsWith ("No", checkRequest (12, NULL));
  50. }
  51. }