Example #1
0
 public function testSubmitFeed()
 {
     resetLog();
     $this->object->setMock(true, 'submitFeed.xml');
     $this->assertFalse($this->object->submitFeed());
     //nothing set yet
     $this->assertFalse($this->object->getResponse());
     //no response yet either
     $this->object->setFeedContent('yes');
     $this->assertFalse($this->object->submitFeed());
     //no feed type set yet
     $this->object->setFeedType('_MOCK_FEED_');
     $ok = $this->object->submitFeed();
     //now it is good
     $this->assertNull($ok);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: submitFeed.xml', $check[1]);
     $this->assertEquals('Feed\'s contents must be set in order to submit it!', $check[2]);
     $this->assertEquals('Feed Type must be set in order to submit a feed!', $check[3]);
     $this->assertEquals('Fetched Mock File: mock/submitFeed.xml', $check[4]);
     $this->assertEquals('Successfully submitted feed #1234567890 (_MOCK_FEED_)', $check[5]);
     $o = $this->object->getOptions();
     $this->assertEquals('SubmitFeed', $o['Action']);
     $r = $this->object->getResponse();
     $this->assertInternalType('array', $r);
     $this->assertArrayHasKey('FeedSubmissionId', $r);
     $this->assertEquals('1234567890', $r['FeedSubmissionId']);
     $this->assertArrayHasKey('FeedType', $r);
     $this->assertEquals('_MOCK_FEED_', $r['FeedType']);
     $this->assertArrayHasKey('SubmittedDate', $r);
     $this->assertEquals('2012-12-12T12:12:12+00:00', $r['SubmittedDate']);
     $this->assertArrayHasKey('FeedProcessingStatus', $r);
     $this->assertEquals('_SUBMITTED_', $r['FeedProcessingStatus']);
 }