Prepare the code to test properly sendtomail.php
This commit is contained in:
parent
15fe0401bc
commit
9753938a2e
3 changed files with 92 additions and 12 deletions
56
test/mailTest.php
Normal file
56
test/mailTest.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* COPS (Calibre OPDS PHP Server) test file
|
||||
*
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
* @author Sébastien Lucas <sebastien@slucas.fr>
|
||||
*/
|
||||
|
||||
require_once (dirname(__FILE__) . "/config_test.php");
|
||||
require_once (dirname(__FILE__) . "/../book.php");
|
||||
require_once (dirname(__FILE__) . "/../sendtomail.php");
|
||||
|
||||
class MailTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCheckConfiguration () {
|
||||
global $config;
|
||||
|
||||
$this->assertFalse(checkConfiguration ());
|
||||
}
|
||||
|
||||
public function testCheckConfigurationNull () {
|
||||
global $config;
|
||||
$config['cops_mail_configuration'] = NULL;
|
||||
|
||||
$this->assertStringStartsWith("NOK", checkConfiguration ());
|
||||
}
|
||||
|
||||
public function testCheckConfigurationNotArray () {
|
||||
global $config;
|
||||
$config['cops_mail_configuration'] = "Test";
|
||||
|
||||
$this->assertStringStartsWith("NOK", checkConfiguration ());
|
||||
}
|
||||
|
||||
public function testCheckConfigurationSmtpEmpty () {
|
||||
global $config;
|
||||
$config['cops_mail_configuration']["smtp.host"] = "";
|
||||
|
||||
$this->assertStringStartsWith("NOK", checkConfiguration ());
|
||||
}
|
||||
|
||||
public function testCheckConfigurationEmailEmpty () {
|
||||
global $config;
|
||||
$config['cops_mail_configuration']["address.from"] = "";
|
||||
|
||||
$this->assertStringStartsWith("NOK", checkConfiguration ());
|
||||
}
|
||||
|
||||
public function testCheckConfigurationEmailNotValid () {
|
||||
global $config;
|
||||
$config['cops_mail_configuration']["address.from"] = "a";
|
||||
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue