mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
remove var_dumps; fix assertEqual -> assertEquals and other random psalm findings
This commit is contained in:
parent
93cc4d9e8c
commit
97528f3ebd
@ -44,6 +44,7 @@ class PaCryptTest extends \PHPUnit\Framework\TestCase {
|
||||
}
|
||||
|
||||
public function testAuthlib() {
|
||||
global $CONF;
|
||||
|
||||
// too many options!
|
||||
foreach (
|
||||
@ -51,6 +52,7 @@ class PaCryptTest extends \PHPUnit\Framework\TestCase {
|
||||
'md5' => 'CY9rzUYh03PK3k6DJie09g==',
|
||||
// crypt requires salt ...
|
||||
'SHA' => 'qUqP5cyxm6YcTAhz05Hph5gvu9M='] as $flavour => $hash) {
|
||||
|
||||
$CONF['authlib_default_flavour'] = $flavour;
|
||||
|
||||
$stored = "{" . $flavour . "}$hash";
|
||||
|
@ -25,13 +25,10 @@ class RemoteAliasTest extends RemoteTest {
|
||||
}
|
||||
|
||||
public function testGet() {
|
||||
try {
|
||||
/* although we created an alias record, for users, this isn't returned... */
|
||||
$this->assertEqual($this->alias->get(), array());
|
||||
} catch (Exception $e) {
|
||||
var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
|
||||
}
|
||||
/* although we created an alias record, for users, this isn't returned... */
|
||||
$this->assertEquals($this->alias->get(), array());
|
||||
}
|
||||
|
||||
public function testHasStoreAndForward() {
|
||||
$this->assertTrue($this->alias->hasStoreAndForward());
|
||||
}
|
||||
@ -41,7 +38,7 @@ class RemoteAliasTest extends RemoteTest {
|
||||
$this->assertFalse($this->alias->hasStoreAndForward());
|
||||
$this->assertTrue($this->alias->update(array('roger@rabbit.com'), 'remote_only'));
|
||||
$this->assertTrue($this->alias->update(array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'), 'remote_only'));
|
||||
$this->assertEqual($this->alias->get(), array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'));
|
||||
$this->assertEquals($this->alias->get(), array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'));
|
||||
$this->assertFalse($this->alias->hasStoreAndForward());
|
||||
}
|
||||
|
||||
@ -52,9 +49,9 @@ class RemoteAliasTest extends RemoteTest {
|
||||
}
|
||||
$orig_aliases[] = 'roger@robbit.com';
|
||||
$this->assertTrue($this->alias->update($orig_aliases, 'forward_and_store'));
|
||||
$this->assertEqual($this->alias->get(), $orig_aliases);
|
||||
$this->assertEquals($this->alias->get(), $orig_aliases);
|
||||
$this->assertTrue($this->alias->update(array($this->username), 'forward_and_store'));
|
||||
$this->assertEqual($this->alias->get(), array());
|
||||
$this->assertEquals($this->alias->get(), array());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,8 @@ abstract class RemoteTest extends \PHPUnit\Framework\TestCase {
|
||||
protected $vacation;
|
||||
protected $alias;
|
||||
|
||||
protected $xmlrpc_client;
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
|
@ -9,13 +9,9 @@ require_once('RemoteTest.php');
|
||||
|
||||
class RemoteUserTest extends RemoteTest {
|
||||
public function testChangePassword() {
|
||||
try {
|
||||
$this->assertTrue($this->user->login($this->username, $this->password));
|
||||
$this->assertTrue($this->user->changePassword($this->password, 'foobar'));
|
||||
$this->assertTrue($this->user->login($this->username, 'foobar'));
|
||||
} catch (Exception $e) {
|
||||
var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
|
||||
}
|
||||
$this->assertTrue($this->user->login($this->username, $this->password));
|
||||
$this->assertTrue($this->user->changePassword($this->password, 'foobar'));
|
||||
$this->assertTrue($this->user->login($this->username, 'foobar'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,13 +26,7 @@ class RemoteVacationTest extends RemoteTest {
|
||||
}
|
||||
|
||||
public function testIsVacationSupported() {
|
||||
try {
|
||||
$this->assertTrue($this->vacation->isVacationSupported());
|
||||
} catch (Exception $e) {
|
||||
var_dump($e);
|
||||
var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
|
||||
die("fail..");
|
||||
}
|
||||
$this->assertTrue($this->vacation->isVacationSupported());
|
||||
}
|
||||
|
||||
public function testCheckVacation() {
|
||||
@ -46,26 +40,23 @@ class RemoteVacationTest extends RemoteTest {
|
||||
}
|
||||
|
||||
public function testSetAway() {
|
||||
try {
|
||||
$this->assertFalse($this->vacation->checkVacation());
|
||||
$this->assertTrue($this->vacation->setAway('zzzz', 'aaaa'));
|
||||
$this->assertTrue($this->vacation->checkVacation());
|
||||
} catch (Exception $e) {
|
||||
var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
|
||||
}
|
||||
$this->assertFalse($this->vacation->checkVacation());
|
||||
$this->assertTrue($this->vacation->setAway('zzzz', 'aaaa'));
|
||||
$this->assertTrue($this->vacation->checkVacation());
|
||||
|
||||
$details = $this->vacation->getDetails();
|
||||
$this->assertEqual($details['subject'], 'zzzz');
|
||||
$this->assertEqual($details['body'], 'aaaa');
|
||||
$this->assertEquals($details['subject'], 'zzzz');
|
||||
$this->assertEquals($details['body'], 'aaaa');
|
||||
|
||||
$this->vacation->remove();
|
||||
$details = $this->vacation->getDetails();
|
||||
$this->assertEqual($details['subject'], 'zzzz');
|
||||
$this->assertEqual($details['body'], 'aaaa');
|
||||
$this->assertEquals($details['subject'], 'zzzz');
|
||||
$this->assertEquals($details['body'], 'aaaa');
|
||||
|
||||
$this->vacation->setAway('subject', 'body');
|
||||
$details = $this->vacation->getDetails();
|
||||
$this->assertEqual($details['subject'], 'subject');
|
||||
$this->assertEqual($details['body'], 'body');
|
||||
$this->assertEquals($details['subject'], 'subject');
|
||||
$this->assertEquals($details['body'], 'body');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
require_once('common.php');
|
||||
|
||||
class ValidatePasswordTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
public function testBasic() {
|
||||
$config = Config::getInstance();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user