public function __construct(array $jsonData)
 {
     foreach ($jsonData['Subscribers'] as $subscriber) {
         $entry = Subscriber::withJSON($subscriber);
         $this->append($entry);
     }
 }
 /**
  * Test if SubscriberByEmailAction returns a Subscriber object when onParse is called.
  * @group SubscriberByEmailTest
  * @covers moosend\Actions\SubscriberByEmail\SubscriberByEmailAction::onParse
  */
 public function test_Should_Return_Subscriber_Object_When_SubscriberByEmailAction_Calls_onParse()
 {
     $jsonData = json_decode(file_get_contents(__DIR__ . '/../../JsonResponses/getSubscriberByEmailJsonResponse.html'), true)['Context'];
     $returnedObject = $this->_action->onParse($jsonData);
     $expectedSubscriberObject = Subscriber::withJSON($jsonData);
     $this->assertEquals($expectedSubscriberObject, $returnedObject);
 }
Esempio n. 3
0
 public function onParse($jsonData)
 {
     return Subscriber::withJSON($jsonData);
 }
Esempio n. 4
0
 public function setUp()
 {
     $this->_jsonData = json_decode(file_get_contents(__DIR__ . '/../../tests/JsonResponses/getSubscriberByEmailJsonResponse.html'), true)['Context'];
     $this->_subscriber = Subscriber::withJSON($this->_jsonData);
 }