fix tests
This commit is contained in:
@ -6,7 +6,6 @@ use Codeception\Stub\Expected;
|
||||
use MailPoet\API\JSON\v1\Services;
|
||||
use MailPoet\API\JSON\Response as APIResponse;
|
||||
use MailPoet\Config\Installer;
|
||||
use MailPoet\Models\Setting;
|
||||
use MailPoet\Services\Bridge;
|
||||
|
||||
class ServicesTest extends \MailPoetTest {
|
||||
@ -275,8 +274,8 @@ class ServicesTest extends \MailPoetTest {
|
||||
$this
|
||||
);
|
||||
$response = $this->services_endpoint->checkMSSKey($this->data);
|
||||
expect(isset($response->data['public_id']))->true();
|
||||
expect($response->data['public_id'])->notEmpty();
|
||||
expect($response->data['public_id'])->equals(Setting::getValue('public_id'));
|
||||
}
|
||||
|
||||
function testItRespondsContainsPublicIdForPremium() {
|
||||
@ -288,8 +287,8 @@ class ServicesTest extends \MailPoetTest {
|
||||
),
|
||||
$this
|
||||
);
|
||||
$response = $this->services_endpoint->checkMSSKey($this->data);
|
||||
$response = $this->services_endpoint->checkPremiumKey($this->data);
|
||||
expect(isset($response->data['public_id']))->true();
|
||||
expect($response->data['public_id'])->notEmpty();
|
||||
expect($response->data['public_id'])->equals(Setting::getValue('public_id'));
|
||||
}
|
||||
}
|
||||
|
@ -107,25 +107,26 @@ class AnalyticsTest extends \MailPoetTest {
|
||||
$fakePublicId = 'alk-ded-egrg-zaz-fvf-rtr-zdef';
|
||||
|
||||
$analytics->setPublicId($fakePublicId);
|
||||
expect($analytics->getValue('public_id'))->equals($fakePublicId);
|
||||
expect(Setting::getValue('public_id'))->equals($fakePublicId);
|
||||
}
|
||||
|
||||
function testIsPublicIdNew() {
|
||||
$analytics = new Analytics(new Reporter());
|
||||
$fakePublicId = 'alk-ded-egrg-zaz-fvf-rtr-zdef';
|
||||
|
||||
$analytics->setValue('new_public_id', 'false');
|
||||
Setting::setValue('public_id', 'old-fake-public-id');
|
||||
Setting::setValue('new_public_id', 'false');
|
||||
$analytics->setPublicId($fakePublicId);
|
||||
// When we update public_id it's marked as new
|
||||
expect($analytics->getValue('new_public_id'))->equals('true');
|
||||
expect(Setting::getValue('new_public_id'))->equals('true');
|
||||
expect($analytics->isPublicIdNew())->true();
|
||||
expect($analytics->getValue('new_public_id'))->equals('false');
|
||||
expect(Setting::getValue('new_public_id'))->equals('false');
|
||||
|
||||
$analytics->setPublicId($fakePublicId);
|
||||
// We tried to update public_id with the same value, so it's not marked as new
|
||||
expect($analytics->getValue('new_public_id'))->equals('false');
|
||||
expect(Setting::getValue('new_public_id'))->equals('false');
|
||||
expect($analytics->isPublicIdNew())->false();
|
||||
expect($analytics->getValue('new_public_id'))->equals('false');
|
||||
expect(Setting::getValue('new_public_id'))->equals('false');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user