Add space between catch and ‘(‘

[MAILPOET-1791]
This commit is contained in:
Ján Mikláš
2019-02-13 12:57:42 +01:00
committed by M. Shull
parent a8972ca281
commit 9e9561e576
50 changed files with 115 additions and 115 deletions

View File

@ -172,7 +172,7 @@ class API {
}
$response = $endpoint->{$this->_request_method}($this->_request_data);
return $response;
} catch(\Exception $e) {
} catch (\Exception $e) {
$error_message = $e->getMessage();
$error_response = $this->createErrorResponse(Error::BAD_REQUEST, $error_message, Response::STATUS_BAD_REQUEST);
return $error_response;

View File

@ -293,7 +293,7 @@ class Forms extends APIEndpoint {
try {
$meta = $this->bulk_action->apply('\MailPoet\Models\Form', $data);
return $this->successResponse(null, $meta);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));

View File

@ -19,7 +19,7 @@ class ImportExport extends APIEndpoint {
$mailChimp = new MailChimp($data['api_key']);
$lists = $mailChimp->getLists();
return $this->successResponse($lists);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));
@ -31,7 +31,7 @@ class ImportExport extends APIEndpoint {
$mailChimp = new MailChimp($data['api_key']);
$subscribers = $mailChimp->getSubscribers($data['lists']);
return $this->successResponse($subscribers);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));
@ -58,7 +58,7 @@ class ImportExport extends APIEndpoint {
);
$process = $import->process();
return $this->successResponse($process);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));
@ -72,7 +72,7 @@ class ImportExport extends APIEndpoint {
);
$process = $export->process();
return $this->successResponse($process);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));

View File

@ -27,7 +27,7 @@ class MP2Migrator extends APIEndpoint {
try {
$process = $this->MP2Migrator->import($data);
return $this->successResponse($process);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));
@ -44,7 +44,7 @@ class MP2Migrator extends APIEndpoint {
try {
$process = $this->MP2Migrator->stopImport();
return $this->successResponse($process);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));
@ -61,7 +61,7 @@ class MP2Migrator extends APIEndpoint {
try {
$process = $this->MP2Migrator->skipImport();
return $this->successResponse($process);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));

View File

@ -22,7 +22,7 @@ class Mailer extends APIEndpoint {
(isset($data['reply_to'])) ? $data['reply_to'] : false
);
$result = $mailer->send($data['newsletter'], $data['subscriber']);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));

View File

@ -394,7 +394,7 @@ class Newsletters extends APIEndpoint {
Newsletter::findOne($id)->asArray()
);
}
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));
@ -464,7 +464,7 @@ class Newsletters extends APIEndpoint {
try {
$meta = $this->bulk_action->apply('\MailPoet\Models\Newsletter', $data);
return $this->successResponse(null, $meta);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));

View File

@ -150,7 +150,7 @@ class Segments extends APIEndpoint {
function synchronize() {
try {
WP::synchronizeUsers();
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));
@ -163,7 +163,7 @@ class Segments extends APIEndpoint {
try {
$meta = $this->bulk_action->apply('\MailPoet\Models\Segment', $data);
return $this->successResponse(null, $meta);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));

View File

@ -36,7 +36,7 @@ class SendingQueue extends APIEndpoint {
// check that the sending method has been configured properly
try {
new \MailPoet\Mailer\Mailer(false);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));

View File

@ -37,7 +37,7 @@ class Services extends APIEndpoint {
try {
$result = $this->bridge->checkMSSKey($key);
$this->bridge->storeMSSKeyAndState($key, $result);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));
@ -99,7 +99,7 @@ class Services extends APIEndpoint {
try {
$result = $this->bridge->checkPremiumKey($key);
$this->bridge->storePremiumKeyAndState($key, $result);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));

View File

@ -27,7 +27,7 @@ class Setup extends APIEndpoint {
$activator->activate();
$this->wp->doAction('mailpoet_setup_reset');
return $this->successResponse();
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));

View File

@ -300,7 +300,7 @@ class Subscribers extends APIEndpoint {
$bulk_action = new BulkAction($data);
return $this->successResponse(null, $bulk_action->apply());
}
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));

View File

@ -47,7 +47,7 @@ class Initializer {
try {
$this->setupDB();
} catch(\Exception $e) {
} catch (\Exception $e) {
return WPNotice::displayError(Helpers::replaceLinkTags(
__('Unable to connect to the database (the database is unable to open a file or folder), the connection is likely not configured correctly. Please read our [link] Knowledge Base article [/link] for steps how to resolve it.', 'mailpoet'),
'//beta.docs.mailpoet.com/article/200-solving-database-connection-issues',
@ -120,7 +120,7 @@ class Initializer {
try {
$this->setupRenderer();
$this->setupWidget();
} catch(\Exception $e) {
} catch (\Exception $e) {
$this->handleFailedInitialization($e);
}
}
@ -158,7 +158,7 @@ class Initializer {
$this->setupDeactivationSurvey();
do_action('mailpoet_initialized', MAILPOET_VERSION);
} catch(\Exception $e) {
} catch (\Exception $e) {
return $this->handleFailedInitialization($e);
}
@ -168,7 +168,7 @@ class Initializer {
function maybeDbUpdate() {
try {
$current_db_version = $this->container->get(SettingsController::class)->get('db_version');
} catch(\Exception $e) {
} catch (\Exception $e) {
$current_db_version = null;
}
@ -252,7 +252,7 @@ class Initializer {
$this->setupJSONAPI();
$this->setupRouter();
$this->setupUserLocale();
} catch(\Exception $e) {
} catch (\Exception $e) {
$this->handleFailedInitialization($e);
}
}

View File

@ -852,7 +852,7 @@ class Menu {
function displayPage($template, $data) {
try {
echo $this->renderer->render($template, $data);
} catch(\Exception $e) {
} catch (\Exception $e) {
$notice = new WPNotice(WPNotice::TYPE_ERROR, $e->getMessage());
$notice->displayWPNotice();
}

View File

@ -107,7 +107,7 @@ class Renderer {
function render($template, $context = array()) {
try {
return $this->renderer->render($template, $context);
} catch(\RuntimeException $e) {
} catch (\RuntimeException $e) {
throw new \Exception(sprintf(
__('Failed to render template "%s". Please ensure the template cache folder "%s" exists and has write permissions. Terminated with error: "%s"'),
$template,

View File

@ -156,7 +156,7 @@ class RequirementsChecker {
try {
$reflector = new \ReflectionClass($namespaced_class);
return $reflector->getFileName();
} catch(\ReflectionException $ex) {
} catch (\ReflectionException $ex) {
return false;
}
}

View File

@ -27,7 +27,7 @@ class CronTrigger {
return (class_exists($trigger_class)) ?
$trigger_class::run() :
false;
} catch(\Exception $e) {
} catch (\Exception $e) {
// cron exceptions should not prevent the rest of the site from loading
}
}

View File

@ -28,7 +28,7 @@ class Daemon {
$this->executePremiumKeyCheckWorker();
$this->executeBounceWorker();
// TODO: execute WooCommerceSync worker
} catch(\Exception $e) {
} catch (\Exception $e) {
CronHelper::saveDaemonLastError($e->getMessage());
}
// Log successful execution

View File

@ -46,7 +46,7 @@ class Worker {
foreach (self::getDueTasks() as $task) {
try {
$this->mailer->send($this->constructNewsletter($task), $settings['address']);
} catch(\Exception $e) {
} catch (\Exception $e) {
if(WP_DEBUG) {
throw $e;
}

View File

@ -281,7 +281,7 @@ class Date extends Base {
if($datetime !== false && !empty($datetime)) {
try {
$datetime = Carbon::parse($datetime)->toDateTimeString();
} catch(\Exception $e) {
} catch (\Exception $e) {
$datetime = false;
}
}

View File

@ -89,7 +89,7 @@ class Widget extends \WP_Widget {
try {
echo $this->renderer->render('form/iframe.html', $data);
} catch(\Exception $e) {
} catch (\Exception $e) {
echo $e->getMessage();
}
@ -328,7 +328,7 @@ EOL;
$output = $renderer->render('form/widget.html', $data);
$output = do_shortcode($output);
$output = $this->wp->applyFilters('mailpoet_form_widget_post_process', $output);
} catch(\Exception $e) {
} catch (\Exception $e) {
$output = $e->getMessage();
}
}

View File

@ -72,7 +72,7 @@ class AmazonSES {
$this->url,
$this->request($newsletter, $subscriber, $extra_params)
);
} catch(\Exception $e) {
} catch (\Exception $e) {
$error = $this->error_mapper->getErrorFromException($e, $subscriber);
return Mailer::formatMailerErrorResult($error);
}

View File

@ -32,7 +32,7 @@ class PHPMail {
try {
$mailer = $this->configureMailerWithMessage($newsletter, $subscriber, $extra_params);
$result = $mailer->send();
} catch(\Exception $e) {
} catch (\Exception $e) {
return Mailer::formatMailerErrorResult($this->error_mapper->getErrorFromException($e, $subscriber));
}
if($result === true) {

View File

@ -51,7 +51,7 @@ class SMTP {
try {
$message = $this->createMessage($newsletter, $subscriber, $extra_params);
$result = $this->mailer->send($message);
} catch(\Exception $e) {
} catch (\Exception $e) {
return Mailer::formatMailerErrorResult(
$this->error_mapper->getErrorFromException($e, $subscriber)
);

View File

@ -197,9 +197,9 @@ class Model extends \Sudzy\ValidModel {
$this->_new_record = $this->isNew();
try {
parent::save();
} catch(\Sudzy\ValidationException $e) {
} catch (\Sudzy\ValidationException $e) {
$this->setError($e->getValidationErrors());
} catch(\PDOException $e) {
} catch (\PDOException $e) {
switch ($e->getCode()) {
case 23000:
preg_match("/for key \'(.*?)\'/i", $e->getMessage(), $matches);
@ -330,7 +330,7 @@ class Model extends \Sudzy\ValidModel {
public static function __callStatic($method, $parameters) {
try {
return parent::__callStatic($method, $parameters);
} catch(\PDOException $e) {
} catch (\PDOException $e) {
throw new \Exception($e->getMessage());
}
}

View File

@ -103,7 +103,7 @@ class ScheduledTask extends Model {
ScheduledTaskSubscriber::where('task_id', $this->id)->deleteMany();
parent::delete();
\ORM::get_db()->commit();
} catch(\Exception $error) {
} catch (\Exception $error) {
\ORM::get_db()->rollBack();
throw $error;
}

View File

@ -233,7 +233,7 @@ class Scheduler {
$schedule = \Cron\CronExpression::factory($schedule);
$next_run_date = $schedule->getNextRunDate(Carbon::createFromTimestamp($from_timestamp))
->format('Y-m-d H:i:s');
} catch(\Exception $e) {
} catch (\Exception $e) {
$next_run_date = false;
}
return $next_run_date;
@ -246,7 +246,7 @@ class Scheduler {
$schedule = \Cron\CronExpression::factory($schedule);
$previous_run_date = $schedule->getPreviousRunDate(Carbon::createFromTimestamp($from_timestamp))
->format('Y-m-d H:i:s');
} catch(\Exception $e) {
} catch (\Exception $e) {
$previous_run_date = false;
}
return $previous_run_date;

View File

@ -43,7 +43,7 @@ class Bridge {
$mailer_config = Mailer::getMailerConfig();
return !empty($mailer_config['method'])
&& $mailer_config['method'] === Mailer::METHOD_MAILPOET;
} catch(\Exception $e) {
} catch (\Exception $e) {
return false;
}
}

View File

@ -103,7 +103,7 @@ class ConfirmationEmailMailer {
$this->mailer->getSenderNameAndAddress($from);
$this->mailer->getReplyToNameAndAddress($reply_to);
return $this->mailer->send($email, $subscriber);
} catch(\Exception $e) {
} catch (\Exception $e) {
$subscriber->setError($e->getMessage());
return false;
}

View File

@ -64,7 +64,7 @@ class Export {
'generate' . strtoupper($this->export_format_option)
)
);
} catch(\Exception $e) {
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
return array(

View File

@ -129,7 +129,7 @@ class Import {
$this->synchronizeWPUsers($wp_users);
}
}
} catch(\Exception $e) {
} catch (\Exception $e) {
throw new \Exception(__('Unable to save imported subscribers.', 'mailpoet'));
}

View File

@ -65,7 +65,7 @@ class NewSubscriberNotificationMailer {
try {
$this->mailer->getSenderNameAndAddress($this->constructSenderEmail());
$this->mailer->send($this->constructNewsletter($subscriber, $segments), $settings['address']);
} catch(\Exception $e) {
} catch (\Exception $e) {
if(WP_DEBUG) {
throw $e;
}

View File

@ -14,7 +14,7 @@ class APITest extends \MailPoetTest {
try {
API::MP('invalid_version');
$this->fail('Incorrect API version exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Invalid API version.');
}
}

View File

@ -534,7 +534,7 @@ class SubscribersTest extends \MailPoetTest {
$this->obfuscatedSegments => array($this->segment_1->id, $this->segment_2->id)
));
$this->fail('It should not be possible to subscribe a second time so soon');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('You need to wait 60 seconds before subscribing again.');
}
}
@ -561,7 +561,7 @@ class SubscribersTest extends \MailPoetTest {
$this->obfuscatedSegments => array($this->segment_1->id, $this->segment_2->id)
));
$this->fail('It should not be possible to resubscribe a second time so soon');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('You need to wait 60 seconds before subscribing again.');
}
}

View File

@ -61,7 +61,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->subscribeToLists(false, array(1,2,3));
$this->fail('Subscriber does not exist exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('This subscriber does not exist.');
}
}
@ -74,14 +74,14 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->subscribeToLists($subscriber->id, array(1,2,3));
$this->fail('Missing segments exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('These lists do not exist.');
}
// single list error message
try {
$this->getApi()->subscribeToLists($subscriber->id, array(1));
$this->fail('Missing segments exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('This list does not exist.');
}
}
@ -99,7 +99,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->subscribeToLists($subscriber->id, array($segment->id));
$this->fail('WP Users segment exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals("Can't subscribe to a WordPress Users list with ID {$segment->id}.");
}
}
@ -117,7 +117,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->subscribeToLists($subscriber->id, array($segment->id));
$this->fail('WooCommerce Customers segment exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals("Can't subscribe to a WooCommerce Customers list with ID {$segment->id}.");
}
}
@ -136,14 +136,14 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->subscribeToLists($subscriber->id, array($segment->id, 90, 100));
$this->fail('Missing segments with IDs exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Lists with IDs 90, 100 do not exist.');
}
// single list error message
try {
$this->getApi()->subscribeToLists($subscriber->id, array($segment->id, 90));
$this->fail('Missing segments with IDs exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('List with ID 90 does not exist.');
}
}
@ -182,7 +182,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->subscribeToLists($subscriber->id, array());
$this->fail('Segments are required exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('At least one segment ID is required.');
}
@ -307,7 +307,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->addSubscriber(array());
$this->fail('Subscriber email address required exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Subscriber email address is required.');
}
}
@ -319,7 +319,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->addSubscriber(array('email' => $subscriber->email));
$this->fail('Subscriber exists exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('This subscriber already exists.');
}
}
@ -331,7 +331,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->addSubscriber($subscriber);
$this->fail('Failed to add subscriber exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->contains('Failed to add subscriber:');
// error message (converted to lowercase) returned by the model
expect($e->getMessage())->contains('your email address is invalid!');
@ -525,7 +525,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->addList(array());
$this->fail('List name required exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('List name is required.');
}
}
@ -537,7 +537,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->addList(array('name' => $segment->name));
$this->fail('List exists exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('This list already exists.');
}
}
@ -556,7 +556,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->unsubscribeFromLists(false, array(1,2,3));
$this->fail('Subscriber does not exist exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('This subscriber does not exist.');
}
}
@ -569,14 +569,14 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->unsubscribeFromLists($subscriber->id, array(1,2,3));
$this->fail('Missing segments exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('These lists do not exist.');
}
// single list error message
try {
$this->getApi()->unsubscribeFromLists($subscriber->id, array(1));
$this->fail('Missing segments exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('This list does not exist.');
}
}
@ -595,14 +595,14 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->unsubscribeFromLists($subscriber->id, array($segment->id, 90, 100));
$this->fail('Missing segments with IDs exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Lists with IDs 90, 100 do not exist.');
}
// single list error message
try {
$this->getApi()->unsubscribeFromLists($subscriber->id, array($segment->id, 90));
$this->fail('Missing segments with IDs exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('List with ID 90 does not exist.');
}
}
@ -620,7 +620,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->unsubscribeFromLists($subscriber->id, array($segment->id));
$this->fail('WP Users segment exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals("Can't unsubscribe from a WordPress Users list with ID {$segment->id}.");
}
}
@ -638,7 +638,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->unsubscribeFromLists($subscriber->id, array($segment->id));
$this->fail('WooCommerce Customers segment exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals("Can't unsubscribe from a WooCommerce Customers list with ID {$segment->id}.");
}
}
@ -676,7 +676,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->unsubscribeFromLists($subscriber->id, array());
$this->fail('Segments are required exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('At least one segment ID is required.');
}
@ -707,7 +707,7 @@ class APITest extends \MailPoetTest {
try {
$this->getApi()->getSubscriber('some_fake_email');
$this->fail('Subscriber does not exist exception should have been thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('This subscriber does not exist.');
}
}

View File

@ -76,7 +76,7 @@ class DatabaseTest extends \MailPoetTest {
try {
$this->database->setupDriverOptions();
$this->fail('Exception was not thrown');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e instanceof \PDOException)->false();
expect($e->getMessage())->equals($message);
}

View File

@ -109,7 +109,7 @@ class RendererTest extends \MailPoetTest {
try {
$renderer->render('non-existing-template.html', array('somekey' => 'someval'));
self::fail('Twig exception was not rethrown');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->contains($exception_message);
expect($e->getMessage())->notEquals($exception_message);
}

View File

@ -240,7 +240,7 @@ class CronHelperTest extends \MailPoetTest {
try {
CronHelper::getSiteUrl($site_url);
self::fail('Site URL is unreachable exception not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Site URL is unreachable.');
}
}
@ -257,7 +257,7 @@ class CronHelperTest extends \MailPoetTest {
try {
CronHelper::enforceExecutionLimit($time - CronHelper::DAEMON_EXECUTION_LIMIT);
self::fail('Execution limit exception not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Maximum execution time has been reached.');
}
}

View File

@ -37,7 +37,7 @@ class SchedulerTest extends \MailPoetTest {
try {
$scheduler = new Scheduler(microtime(true) - CronHelper::DAEMON_EXECUTION_LIMIT);
self::fail('Maximum execution time limit exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Maximum execution time has been reached.');
}
}
@ -525,7 +525,7 @@ class SchedulerTest extends \MailPoetTest {
try {
$scheduler->process();
self::fail('Maximum execution time limit exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Maximum execution time has been reached.');
}
}

View File

@ -132,7 +132,7 @@ class SendingQueueTest extends \MailPoetTest {
try {
$sending_queue_worker->process();
self::fail('Execution limits function was not called.');
} catch(\Exception $e) {
} catch (\Exception $e) {
// No exception handling needed
}
}
@ -630,7 +630,7 @@ class SendingQueueTest extends \MailPoetTest {
$statistics = []
);
$this->fail('Paused sending exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Sending has been paused.');
}
$mailer_log = MailerLog::getMailerLog();

View File

@ -316,7 +316,7 @@ class NewsletterTest extends \MailPoetTest {
try {
$this->newsletter_task->preProcessNewsletter($this->newsletter, $queue);
self::fail('Sending error exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
$mailer_log = MailerLog::getMailerLog();
expect($mailer_log['error']['operation'])->equals('queue_save');
expect($mailer_log['error']['error_message'])->equals('There was an error processing your newsletter during sending. If possible, please contact us and report this issue.');
@ -334,7 +334,7 @@ class NewsletterTest extends \MailPoetTest {
try {
$this->newsletter_task->preProcessNewsletter($this->newsletter, $queue_mock);
self::fail('Sending error exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
$mailer_log = MailerLog::getMailerLog();
expect($mailer_log['error']['operation'])->equals('queue_save');
expect($mailer_log['error']['error_message'])->equals('There was an error processing your newsletter during sending. If possible, please contact us and report this issue.');
@ -357,7 +357,7 @@ class NewsletterTest extends \MailPoetTest {
try {
$this->newsletter_task->preProcessNewsletter($this->newsletter, $queue_mock);
self::fail('Sending error exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
$mailer_log = MailerLog::getMailerLog();
expect($mailer_log['error']['operation'])->equals('queue_save');
expect($mailer_log['error']['error_message'])->equals('There was an error processing your newsletter during sending. If possible, please contact us and report this issue.');

View File

@ -28,7 +28,7 @@ class SimpleWorkerTest extends \MailPoetTest {
$worker_class = get_class($worker);
new $worker_class();
$this->fail('SimpleWorker did not throw an exception');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Constant TASK_TYPE is not defined on subclass ' . $worker_class);
}
}
@ -43,7 +43,7 @@ class SimpleWorkerTest extends \MailPoetTest {
microtime(true) - CronHelper::DAEMON_EXECUTION_LIMIT
);
self::fail('Maximum execution time limit exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Maximum execution time has been reached.');
}
}

View File

@ -196,7 +196,7 @@ class MailerLogTest extends \MailPoetTest {
try {
MailerLog::processError($operation = 'send', $error = 'email rejected - sending paused', $error_code = null, $pause_sending = true);
$this->fail('Paused sending exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Sending has been paused.');
}
$mailer_log = MailerLog::getMailerLog();
@ -228,7 +228,7 @@ class MailerLogTest extends \MailPoetTest {
try {
MailerLog::enforceExecutionRequirements();
self::fail('Sending frequency exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Sending frequency limit has been reached.');
}
}
@ -250,7 +250,7 @@ class MailerLogTest extends \MailPoetTest {
try {
MailerLog::enforceExecutionRequirements();
self::fail('Sending frequency exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Sending frequency limit has been reached.');
}
}
@ -271,7 +271,7 @@ class MailerLogTest extends \MailPoetTest {
// sending limit exception should not be thrown
try {
MailerLog::enforceExecutionRequirements();
} catch(\Exception $e) {
} catch (\Exception $e) {
self::fail('Sending frequency exception was thrown.');
}
}
@ -283,7 +283,7 @@ class MailerLogTest extends \MailPoetTest {
try {
MailerLog::enforceExecutionRequirements($mailer_log);
self::fail('Sending waiting to be retried exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Sending is waiting to be retried.');
}
}
@ -298,7 +298,7 @@ class MailerLogTest extends \MailPoetTest {
try {
MailerLog::enforceExecutionRequirements($mailer_log);
self::fail('Sending paused exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Sending has been paused.');
}
$mailer_log = MailerLog::getMailerLog();
@ -324,7 +324,7 @@ class MailerLogTest extends \MailPoetTest {
try {
MailerLog::enforceExecutionRequirements($mailer_log);
self::fail('Sending paused exception was not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Sending has been paused.');
}
}

View File

@ -72,7 +72,7 @@ class MailerTest extends \MailPoetTest {
try {
$mailer = new Mailer();
$this->fail('Mailer did not throw an exception');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Mailer is not configured.');
}
}
@ -81,7 +81,7 @@ class MailerTest extends \MailPoetTest {
try {
$mailer = new Mailer($mailer = $this->mailer);
$this->fail('Mailer did not throw an exception');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Sender name and email are not configured.');
}
}
@ -108,7 +108,7 @@ class MailerTest extends \MailPoetTest {
try {
$mailer = new Mailer(array('method' => 'Unknown'), $this->sender);
$this->fail('Mailer did not throw an exception');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Mailing method does not exist.');
}
}

View File

@ -91,7 +91,7 @@ class AmazonSESTest extends \MailPoetTest {
new AmazonSESMapper()
);
$this->fail('Unsupported region exception was not thrown');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Unsupported Amazon SES region');
}
}

View File

@ -20,7 +20,7 @@ class ModelTest extends \MailPoetTest {
try {
$model::findMany();
$this->fail('Exception was not thrown');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e instanceof \PDOException)->false();
expect($e->getMessage())->equals($message);
}

View File

@ -197,7 +197,7 @@ class ExportTest extends \MailPoetTest {
$this->export->export_path = '/fake_folder';
$this->export->process();
$this->fail('Export did not throw an exception');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())
->equals("The export file could not be saved on the server.");
}
@ -208,7 +208,7 @@ class ExportTest extends \MailPoetTest {
$this->export->export_file = $this->export->getExportFile('csv');
$this->export->export_format_option = 'csv';
$result = $this->export->process();
} catch(\Exception $e) {
} catch (\Exception $e) {
$this->fail('Export to .csv process threw an exception');
}
expect($result['totalExported'])->equals(4);
@ -218,7 +218,7 @@ class ExportTest extends \MailPoetTest {
$this->export->export_file = $this->export->getExportFile('xlsx');
$this->export->export_format_option = 'xlsx';
$result = $this->export->process();
} catch(\Exception $e) {
} catch (\Exception $e) {
$this->fail('Export to .xlsx process threw an exception');
}
expect($result['totalExported'])->equals(4);

View File

@ -73,7 +73,7 @@ class ImportTest extends \MailPoetTest {
try {
$this->import->validateImportData($data);
self::fail('Missing or invalid data exception not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Missing or invalid import data.');
}
// exception should not be thrown when all fields exist
@ -86,7 +86,7 @@ class ImportTest extends \MailPoetTest {
try {
$this->import->validateImportData($data);
self::fail('Missing or invalid data exception not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('Missing or invalid import data.');
}
}
@ -135,7 +135,7 @@ class ImportTest extends \MailPoetTest {
try {
$import->process();
self::fail('No valid subscribers found exception not thrown.');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->equals('No valid subscribers were found.');
}
}

View File

@ -44,7 +44,7 @@ class MailChimpTest extends \MailPoetTest {
$mailchimp->api_key = false;
$lists = $mailchimp->getLists();
$this->fail('MailChimp getLists() did not throw an exception');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->contains('Invalid API Key');
}
}
@ -53,7 +53,7 @@ class MailChimpTest extends \MailPoetTest {
if(getenv('WP_TEST_ENABLE_NETWORK_TESTS') !== 'true') return;
try {
$lists = $this->mailchimp->getLists();
} catch(\Exception $e) {
} catch (\Exception $e) {
$this->fail('MailChimp getLists() threw an exception');
}
expect($lists)->count(2);
@ -67,14 +67,14 @@ class MailChimpTest extends \MailPoetTest {
try {
$subscribers = $this->mailchimp->getSubscribers();
$this->fail('MailChimp getSubscribers() did not throw an exception');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->contains('Did not find any valid lists');
}
try {
$subscribers = $this->mailchimp->getSubscribers(array(12));
$this->fail('MailChimp getSubscribers() did not throw an exception');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())->contains('Did not find any valid lists');
}
}
@ -84,7 +84,7 @@ class MailChimpTest extends \MailPoetTest {
try {
$subscribers = $this->mailchimp->getSubscribers(array($this->lists[0]));
} catch(\Exception $e) {
} catch (\Exception $e) {
$this->fail('MailChimp getSubscribers() threw an exception');
}
@ -101,7 +101,7 @@ class MailChimpTest extends \MailPoetTest {
try {
$subscribers = $this->mailchimp->getSubscribers($this->lists);
$this->fail('MailChimp getSubscribers() did not throw an exception');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())
->contains('The selected lists do not have matching columns (headers)');
}
@ -115,7 +115,7 @@ class MailChimpTest extends \MailPoetTest {
try {
$subscribers = $mailchimp->getSubscribers($this->lists);
$this->fail('MailChimp getSubscribers() did not throw an exception');
} catch(\Exception $e) {
} catch (\Exception $e) {
expect($e->getMessage())
->contains('The information received from MailChimp is too large for processing');
}

View File

@ -38,7 +38,7 @@ class SendingTest extends \MailPoetTest {
try {
$sending = SendingTask::create($this->task, $this->queue);
$this->fail('Exception was not thrown');
} catch(\Exception $e) {
} catch (\Exception $e) {
// No exception handling necessary
}
}

View File

@ -23,7 +23,7 @@ class BatchIteratorTest extends \MailPoetTest {
try {
$iterator = new BatchIterator(0, 0);
$this->fail('Exception was not thrown');
} catch(\Exception $e) {
} catch (\Exception $e) {
// No exception handling necessary
}
}