diff --git a/.gitignore b/.gitignore index b19cdaf..e787af5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ vendor nbproject/* .idea composer.lock -build \ No newline at end of file +build +.phpunit.result.cache \ No newline at end of file diff --git a/composer.json b/composer.json index b6071ab..214673a 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "keywords": ["mailerlite", "sdk", "email", "marketing"], "type": "library", "require": { - "php" : "^7.1", + "php" : "^7.1 || ^8.0", "php-http/client-common": "^2.0", "php-http/discovery": "^1.7", "nyholm/psr7": "^1.0", diff --git a/phpunit.xml b/phpunit.xml index e968daf..0735d25 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,16 +1,15 @@ - + + + tests - - + - \ No newline at end of file + diff --git a/phpunit.xml.bak b/phpunit.xml.bak new file mode 100644 index 0000000..e968daf --- /dev/null +++ b/phpunit.xml.bak @@ -0,0 +1,16 @@ + + + + tests + + + + + + + + \ No newline at end of file diff --git a/tests/BatchTest.php b/tests/BatchTest.php index ea03703..93caf46 100644 --- a/tests/BatchTest.php +++ b/tests/BatchTest.php @@ -46,14 +46,14 @@ public function send_batch() ->setMethod(BatchRequest::METHOD_POST) ->setPath('/api/v2/subscribers') ->setBody([ - 'email' => 'one@batch.com', + 'email' => BATCH_TEST_EMAIL1, ]); $batchTwo = (new BatchRequest()) ->setMethod(BatchRequest::METHOD_POST) ->setPath('/api/v2/subscribers') ->setBody([ - 'email' => 'two@batch.com', + 'email' => BATCH_TEST_EMAIL2, ]); $requests[] = $batchOne; diff --git a/tests/CampaignsTest.php b/tests/CampaignsTest.php index 980ebb4..e481000 100644 --- a/tests/CampaignsTest.php +++ b/tests/CampaignsTest.php @@ -24,7 +24,7 @@ public function create_campaign() $campaignData = [ 'subject' => 'Regular Campaign Subject', 'type' => 'regular', - 'groups' => [2984475, 3237221] // TODO: improve this with creating new groups + 'groups' => [CAMPAIGNS_TEST_GROUP1, CAMPAIGNS_TEST_GROUP2] // TODO: improve this with creating new groups ]; $campaign = $this->campaignsApi->create($campaignData); diff --git a/tests/SegmentsTest.php b/tests/SegmentsTest.php index f8d9d44..5d88215 100644 --- a/tests/SegmentsTest.php +++ b/tests/SegmentsTest.php @@ -25,6 +25,6 @@ public function get_segments() { $segments = $this->segmentsApi->get(); - $this->assertContains('Demo segment', (array) $segments->first()->data[0]); + $this->assertContains(SEGMENTS_TEST_NAME1, (array) $segments->first()->data[0]); } } diff --git a/tests/SubscribersTest.php b/tests/SubscribersTest.php index 4fc0ce6..3b4ec34 100644 --- a/tests/SubscribersTest.php +++ b/tests/SubscribersTest.php @@ -67,7 +67,7 @@ public function update_subscriber() /** @test **/ public function search_for_a_subscriber() { - $subscribers = $this->subscribersApi->search('demo@mailerlite.com'); + $subscribers = $this->subscribersApi->search(SUBSCRIBERS_TEST_EMAIL1); $this->assertTrue(count($subscribers) > 0); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 09f15fd..6334726 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,4 +1,21 @@