Test unitaires de demo

This commit is contained in:
Alan Garcia 2014-04-07 16:28:48 +00:00
parent a074328fae
commit 1c627d243f
2 changed files with 9 additions and 9 deletions

View File

@ -224,7 +224,7 @@ class m_ftp {
}
// Explicitly look for only allowed chars
if ( ! preg_match("/^[A-Za-z0-9_\.\-]+$/", $l) ) {
if ( ! preg_match("/^[A-Za-z0-9]+[A-Za-z0-9_\.\-]*$/", $l) ) {
$err->raise('ftp', _("FTP login is incorrect"));
return false;
}

View File

@ -118,10 +118,13 @@ class m_ftpTest extends PHPUnit_Framework_TestCase
*/
public function testCheck_login()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
// Allowed
$this->assertTrue($this->object->check_login('plop'));
$this->assertTrue($this->object->check_login('00'));
// Forbidden
$this->assertFalse($this->object->check_login('_plop'));
$this->assertFalse($this->object->check_login('arf+'));
}
/**
@ -238,9 +241,6 @@ class m_ftpTest extends PHPUnit_Framework_TestCase
*/
public function testHook_upnp_list()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->assertArrayHasKey('ftp', $this->object->hook_upnp_list());
}
}