|
@@ -594,7 +594,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
|
|
print __METHOD__." login=".$login."\n";
|
|
|
$this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed');
|
|
|
|
|
|
- $login=checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authetntication method
|
|
|
+ $login=checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authentication method
|
|
|
print __METHOD__." login=".$login."\n";
|
|
|
$this->assertEquals($login, 'admin');
|
|
|
|
|
@@ -749,42 +749,42 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
|
|
$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
|
|
|
$tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow
|
|
|
print __METHOD__." url=".$url."\n";
|
|
|
- $this->assertEquals(301, $tmp['http_code'], 'GET url 301 without following -> 301');
|
|
|
+ $this->assertEquals(301, $tmp['http_code'], 'Should GET url 301 without following -> 301');
|
|
|
|
|
|
$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
|
|
|
- $tmp = getURLContent($url); // We DO follow
|
|
|
+ $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200
|
|
|
print __METHOD__." url=".$url."\n";
|
|
|
- $this->assertEquals(200, $tmp['http_code'], 'GET url 301 with following -> 200'); // Test error if return does not contains 'not supported'
|
|
|
+ $this->assertEquals(200, $tmp['http_code'], 'Should GET url 301 with following -> 200 but we get '.$tmp['http_code']);
|
|
|
|
|
|
$url = 'http://localhost';
|
|
|
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
|
|
print __METHOD__." url=".$url."\n";
|
|
|
- $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
|
|
|
+ $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
|
|
|
|
|
|
$url = 'http://127.0.0.1';
|
|
|
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
|
|
print __METHOD__." url=".$url."\n";
|
|
|
- $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL
|
|
|
+ $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL
|
|
|
|
|
|
$url = 'http://127.0.2.1';
|
|
|
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
|
|
print __METHOD__." url=".$url."\n";
|
|
|
- $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL
|
|
|
+ $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL
|
|
|
|
|
|
$url = 'https://169.254.0.1';
|
|
|
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
|
|
print __METHOD__." url=".$url."\n";
|
|
|
- $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL
|
|
|
+ $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL
|
|
|
|
|
|
$url = 'http://[::1]';
|
|
|
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
|
|
print __METHOD__." url=".$url."\n";
|
|
|
- $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL
|
|
|
+ $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL
|
|
|
|
|
|
/*$url = 'localtest.me';
|
|
|
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
|
|
print __METHOD__." url=".$url."\n";
|
|
|
- $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
|
|
|
+ $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
|
|
|
*/
|
|
|
|
|
|
return 0;
|