Renamed 'ip' column to 'subscribed_ip'
- updated code based on PR review
This commit is contained in:
@@ -361,26 +361,34 @@ class SubscribersTest extends MailPoetTest {
|
||||
expect($response->errors[0]['message'])->contains('has no method');
|
||||
}
|
||||
|
||||
function testItCanSubscribeAUser() {
|
||||
// set ip address
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
|
||||
function testItCannotSubscribeWithoutSegments() {
|
||||
$router = new Subscribers();
|
||||
|
||||
// missing segment
|
||||
$response = $router->subscribe(array(
|
||||
'email' => 'toto@mailpoet.com'
|
||||
// no segments specified
|
||||
));
|
||||
|
||||
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);
|
||||
expect($response->errors[0]['message'])->equals('Please select a list.');
|
||||
}
|
||||
|
||||
// proper subscription
|
||||
function testItCanSubscribe() {
|
||||
$router = new Subscribers();
|
||||
$response = $router->subscribe(array(
|
||||
'email' => 'toto@mailpoet.com',
|
||||
'segments' => array($this->segment_1->id, $this->segment_2->id)
|
||||
));
|
||||
expect($response->status)->equals(APIResponse::STATUS_OK);
|
||||
}
|
||||
|
||||
function testItCannotMassSubscribe() {
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
|
||||
$router = new Subscribers();
|
||||
$response = $router->subscribe(array(
|
||||
'email' => 'toto@mailpoet.com',
|
||||
'segments' => array($this->segment_1->id, $this->segment_2->id)
|
||||
));
|
||||
|
||||
try {
|
||||
$response = $router->subscribe(array(
|
||||
|
Reference in New Issue
Block a user