Commit 1c627d24 authored by Alan Garcia's avatar Alan Garcia

Test unitaires de demo

parent a074328f
......@@ -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;
}
......
......@@ -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());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment