remove var_dumps; fix assertEqual -> assertEquals and other random psalm findings

pull/229/head
David Goodwin 6 years ago
parent 93cc4d9e8c
commit 97528f3ebd

@ -44,6 +44,7 @@ class PaCryptTest extends \PHPUnit\Framework\TestCase {
} }
public function testAuthlib() { public function testAuthlib() {
global $CONF;
// too many options! // too many options!
foreach ( foreach (
@ -51,6 +52,7 @@ class PaCryptTest extends \PHPUnit\Framework\TestCase {
'md5' => 'CY9rzUYh03PK3k6DJie09g==', 'md5' => 'CY9rzUYh03PK3k6DJie09g==',
// crypt requires salt ... // crypt requires salt ...
'SHA' => 'qUqP5cyxm6YcTAhz05Hph5gvu9M='] as $flavour => $hash) { 'SHA' => 'qUqP5cyxm6YcTAhz05Hph5gvu9M='] as $flavour => $hash) {
$CONF['authlib_default_flavour'] = $flavour; $CONF['authlib_default_flavour'] = $flavour;
$stored = "{" . $flavour . "}$hash"; $stored = "{" . $flavour . "}$hash";

@ -25,13 +25,10 @@ class RemoteAliasTest extends RemoteTest {
} }
public function testGet() { public function testGet() {
try { /* although we created an alias record, for users, this isn't returned... */
/* although we created an alias record, for users, this isn't returned... */ $this->assertEquals($this->alias->get(), array());
$this->assertEqual($this->alias->get(), array());
} catch (Exception $e) {
var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
}
} }
public function testHasStoreAndForward() { public function testHasStoreAndForward() {
$this->assertTrue($this->alias->hasStoreAndForward()); $this->assertTrue($this->alias->hasStoreAndForward());
} }
@ -41,7 +38,7 @@ class RemoteAliasTest extends RemoteTest {
$this->assertFalse($this->alias->hasStoreAndForward()); $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'), 'remote_only'));
$this->assertTrue($this->alias->update(array('roger@rabbit.com', 'fish@fish.net', 'road@runner.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()); $this->assertFalse($this->alias->hasStoreAndForward());
} }
@ -52,9 +49,9 @@ class RemoteAliasTest extends RemoteTest {
} }
$orig_aliases[] = 'roger@robbit.com'; $orig_aliases[] = 'roger@robbit.com';
$this->assertTrue($this->alias->update($orig_aliases, 'forward_and_store')); $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->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 $vacation;
protected $alias; protected $alias;
protected $xmlrpc_client;
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();

@ -9,13 +9,9 @@ require_once('RemoteTest.php');
class RemoteUserTest extends RemoteTest { class RemoteUserTest extends RemoteTest {
public function testChangePassword() { public function testChangePassword() {
try { $this->assertTrue($this->user->login($this->username, $this->password));
$this->assertTrue($this->user->login($this->username, $this->password)); $this->assertTrue($this->user->changePassword($this->password, 'foobar'));
$this->assertTrue($this->user->changePassword($this->password, 'foobar')); $this->assertTrue($this->user->login($this->username, 'foobar'));
$this->assertTrue($this->user->login($this->username, 'foobar'));
} catch (Exception $e) {
var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
}
} }
} }

@ -26,13 +26,7 @@ class RemoteVacationTest extends RemoteTest {
} }
public function testIsVacationSupported() { public function testIsVacationSupported() {
try { $this->assertTrue($this->vacation->isVacationSupported());
$this->assertTrue($this->vacation->isVacationSupported());
} catch (Exception $e) {
var_dump($e);
var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
die("fail..");
}
} }
public function testCheckVacation() { public function testCheckVacation() {
@ -46,26 +40,23 @@ class RemoteVacationTest extends RemoteTest {
} }
public function testSetAway() { public function testSetAway() {
try { $this->assertFalse($this->vacation->checkVacation());
$this->assertFalse($this->vacation->checkVacation()); $this->assertTrue($this->vacation->setAway('zzzz', 'aaaa'));
$this->assertTrue($this->vacation->setAway('zzzz', 'aaaa')); $this->assertTrue($this->vacation->checkVacation());
$this->assertTrue($this->vacation->checkVacation());
} catch (Exception $e) {
var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
}
$details = $this->vacation->getDetails(); $details = $this->vacation->getDetails();
$this->assertEqual($details['subject'], 'zzzz'); $this->assertEquals($details['subject'], 'zzzz');
$this->assertEqual($details['body'], 'aaaa'); $this->assertEquals($details['body'], 'aaaa');
$this->vacation->remove(); $this->vacation->remove();
$details = $this->vacation->getDetails(); $details = $this->vacation->getDetails();
$this->assertEqual($details['subject'], 'zzzz'); $this->assertEquals($details['subject'], 'zzzz');
$this->assertEqual($details['body'], 'aaaa'); $this->assertEquals($details['body'], 'aaaa');
$this->vacation->setAway('subject', 'body'); $this->vacation->setAway('subject', 'body');
$details = $this->vacation->getDetails(); $details = $this->vacation->getDetails();
$this->assertEqual($details['subject'], 'subject'); $this->assertEquals($details['subject'], 'subject');
$this->assertEqual($details['body'], 'body'); $this->assertEquals($details['body'], 'body');
} }
} }

@ -3,6 +3,7 @@
require_once('common.php'); require_once('common.php');
class ValidatePasswordTest extends \PHPUnit\Framework\TestCase { class ValidatePasswordTest extends \PHPUnit\Framework\TestCase {
public function testBasic() { public function testBasic() {
$config = Config::getInstance(); $config = Config::getInstance();

Loading…
Cancel
Save