From 43a0d92d2f062b22b28d5629cda36d890a760e5f Mon Sep 17 00:00:00 2001 From: qfrery Date: Mon, 16 Jul 2018 11:36:54 +0100 Subject: [PATCH] fix tests --- tests/unit/API/JSON/v1/ServicesTest.php | 7 +++---- tests/unit/Analytics/AnalyticsTest.php | 13 +++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/unit/API/JSON/v1/ServicesTest.php b/tests/unit/API/JSON/v1/ServicesTest.php index 44d10ac726..bcd8b9e8c3 100644 --- a/tests/unit/API/JSON/v1/ServicesTest.php +++ b/tests/unit/API/JSON/v1/ServicesTest.php @@ -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')); } } diff --git a/tests/unit/Analytics/AnalyticsTest.php b/tests/unit/Analytics/AnalyticsTest.php index 10aba20dd9..8b5570c5c1 100644 --- a/tests/unit/Analytics/AnalyticsTest.php +++ b/tests/unit/Analytics/AnalyticsTest.php @@ -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'); } }