Fix tests
This commit is contained in:
@ -97,18 +97,18 @@ class CustomFieldsTest extends MailPoetTest {
|
|||||||
// missing type
|
// missing type
|
||||||
$response = $router->save(array('name' => 'New custom field'));
|
$response = $router->save(array('name' => 'New custom field'));
|
||||||
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
||||||
expect($response->errors[0]['message'])->equals('Please specify a type');
|
expect($response->errors[0]['message'])->equals('Please specify a type.');
|
||||||
|
|
||||||
// missing name
|
// missing name
|
||||||
$response = $router->save(array('type' => 'text'));
|
$response = $router->save(array('type' => 'text'));
|
||||||
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
||||||
expect($response->errors[0]['message'])->equals('Please specify a name');
|
expect($response->errors[0]['message'])->equals('Please specify a name.');
|
||||||
|
|
||||||
// missing data
|
// missing data
|
||||||
$response = $router->save();
|
$response = $router->save();
|
||||||
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
||||||
expect($response->errors[0]['message'])->equals('Please specify a name');
|
expect($response->errors[0]['message'])->equals('Please specify a name.');
|
||||||
expect($response->errors[1]['message'])->equals('Please specify a type');
|
expect($response->errors[1]['message'])->equals('Please specify a type.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItCanGetACustomField() {
|
function testItCanGetACustomField() {
|
||||||
|
@ -65,7 +65,7 @@ class FormsTest extends MailPoetTest {
|
|||||||
$router = new Forms();
|
$router = new Forms();
|
||||||
$response = $router->save(/* missing data */);
|
$response = $router->save(/* missing data */);
|
||||||
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
||||||
expect($response->errors[0]['message'])->equals('Please specify a name');
|
expect($response->errors[0]['message'])->equals('Please specify a name.');
|
||||||
|
|
||||||
$response = $router->save($form_data);
|
$response = $router->save($form_data);
|
||||||
expect($response->status)->equals(APIResponse::STATUS_OK);
|
expect($response->status)->equals(APIResponse::STATUS_OK);
|
||||||
|
@ -80,7 +80,7 @@ class NewslettersTest extends MailPoetTest {
|
|||||||
|
|
||||||
$response = $router->save($invalid_data);
|
$response = $router->save($invalid_data);
|
||||||
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
||||||
expect($response->errors[0]['message'])->equals('Please specify a type');
|
expect($response->errors[0]['message'])->equals('Please specify a type.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItCanSaveAnExistingNewsletter() {
|
function testItCanSaveAnExistingNewsletter() {
|
||||||
@ -284,7 +284,7 @@ class NewslettersTest extends MailPoetTest {
|
|||||||
|
|
||||||
$response = $router->create();
|
$response = $router->create();
|
||||||
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
||||||
expect($response->errors[0]['message'])->equals('Please specify a type');
|
expect($response->errors[0]['message'])->equals('Please specify a type.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItCanGetListingData() {
|
function testItCanGetListingData() {
|
||||||
|
@ -52,7 +52,7 @@ class SegmentsTest extends MailPoetTest {
|
|||||||
$router = new Segments();
|
$router = new Segments();
|
||||||
$response = $router->save(/* missing data */);
|
$response = $router->save(/* missing data */);
|
||||||
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
||||||
expect($response->errors[0]['message'])->equals('Please specify a name');
|
expect($response->errors[0]['message'])->equals('Please specify a name.');
|
||||||
|
|
||||||
$response = $router->save($segment_data);
|
$response = $router->save($segment_data);
|
||||||
expect($response->status)->equals(APIResponse::STATUS_OK);
|
expect($response->status)->equals(APIResponse::STATUS_OK);
|
||||||
|
@ -64,7 +64,7 @@ class MailerTest extends MailPoetTest {
|
|||||||
$mailer = new Mailer();
|
$mailer = new Mailer();
|
||||||
$this->fail('Mailer did not throw an exception');
|
$this->fail('Mailer did not throw an exception');
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
expect($e->getMessage())->equals('Mailer is not configured');
|
expect($e->getMessage())->equals('Mailer is not configured.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ class MailerTest extends MailPoetTest {
|
|||||||
$mailer = new Mailer($mailer = $this->mailer);
|
$mailer = new Mailer($mailer = $this->mailer);
|
||||||
$this->fail('Mailer did not throw an exception');
|
$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');
|
expect($e->getMessage())->equals('Sender name and email are not configured.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ class MailerTest extends MailPoetTest {
|
|||||||
$mailer = new Mailer(array('method' => 'Unknown'), $this->sender);
|
$mailer = new Mailer(array('method' => 'Unknown'), $this->sender);
|
||||||
$this->fail('Mailer did not throw an exception');
|
$this->fail('Mailer did not throw an exception');
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
expect($e->getMessage())->equals('Mailing method does not exist');
|
expect($e->getMessage())->equals('Mailing method does not exist.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class AmazonSESTest extends MailPoetTest {
|
|||||||
);
|
);
|
||||||
$this->fail('Unsupported region exception was not thrown');
|
$this->fail('Unsupported region exception was not thrown');
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
expect($e->getMessage())->equals('Unsupported Amazon SES region.');
|
expect($e->getMessage())->equals('Unsupported Amazon SES region');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,8 +72,8 @@ class CustomFieldTest extends MailPoetTest {
|
|||||||
$errors = $result->getErrors();
|
$errors = $result->getErrors();
|
||||||
|
|
||||||
expect(is_array($errors))->true();
|
expect(is_array($errors))->true();
|
||||||
expect($errors[0])->equals('Please specify a name');
|
expect($errors[0])->equals('Please specify a name.');
|
||||||
expect($errors[1])->equals('Please specify a type');
|
expect($errors[1])->equals('Please specify a type.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItHasACreatedAtOnCreation() {
|
function testItHasACreatedAtOnCreation() {
|
||||||
|
@ -19,7 +19,7 @@ class FormTest extends MailPoetTest {
|
|||||||
$errors = $result->getErrors();
|
$errors = $result->getErrors();
|
||||||
|
|
||||||
expect(is_array($errors))->true();
|
expect(is_array($errors))->true();
|
||||||
expect($errors[0])->equals('Please specify a name');
|
expect($errors[0])->equals('Please specify a name.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItCanBeGrouped() {
|
function testItCanBeGrouped() {
|
||||||
|
@ -52,8 +52,8 @@ class NewsletterOptionFieldTest extends MailPoetTest {
|
|||||||
$errors = $result->getErrors();
|
$errors = $result->getErrors();
|
||||||
|
|
||||||
expect(is_array($errors))->true();
|
expect(is_array($errors))->true();
|
||||||
expect($errors[0])->equals('Please specify a name');
|
expect($errors[0])->equals('Please specify a name.');
|
||||||
expect($errors[1])->equals('Please specify a newsletter type');
|
expect($errors[1])->equals('Please specify a newsletter type.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItHasACreatedAtOnCreation() {
|
function testItHasACreatedAtOnCreation() {
|
||||||
|
@ -26,8 +26,8 @@ class NewsletterTemplateTest extends MailPoetTest {
|
|||||||
$errors = $result->getErrors();
|
$errors = $result->getErrors();
|
||||||
|
|
||||||
expect(is_array($errors))->true();
|
expect(is_array($errors))->true();
|
||||||
expect($errors[0])->equals('Please specify a name');
|
expect($errors[0])->equals('Please specify a name.');
|
||||||
expect($errors[1])->equals('The template body cannot be empty');
|
expect($errors[1])->equals('The template body cannot be empty.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItHasName() {
|
function testItHasName() {
|
||||||
|
@ -72,7 +72,7 @@ class SegmentTest extends MailPoetTest {
|
|||||||
$errors = $result->getErrors();
|
$errors = $result->getErrors();
|
||||||
|
|
||||||
expect(is_array($errors))->true();
|
expect(is_array($errors))->true();
|
||||||
expect($errors[0])->equals('Please specify a name');
|
expect($errors[0])->equals('Please specify a name.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItHasACreatedAtOnCreation() {
|
function testItHasACreatedAtOnCreation() {
|
||||||
|
@ -16,7 +16,7 @@ class SettingTest extends MailPoetTest {
|
|||||||
$errors = $invalid_setting->getErrors();
|
$errors = $invalid_setting->getErrors();
|
||||||
|
|
||||||
expect($errors)->notEmpty();
|
expect($errors)->notEmpty();
|
||||||
expect($errors[0])->equals('Please specify a name');
|
expect($errors[0])->equals('Please specify a name.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItHasDefaultSettings() {
|
function testItHasDefaultSettings() {
|
||||||
|
@ -61,7 +61,7 @@ class FrontRouterTest extends MailPoetTest {
|
|||||||
expect($result)->equals(
|
expect($result)->equals(
|
||||||
array(
|
array(
|
||||||
404,
|
404,
|
||||||
'Invalid router endpoint.'
|
'Invalid router endpoint'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user