public function testGetUrlCreated() { $curlRequestMock = $this->getMock('MadMimi\\CurlRequest'); $curlRequestMock->method('getInfo')->willReturn(200); $connectionMock = $this->getMockBuilder('MadMimi\\Connection')->setMethods(['debug'])->setConstructorArgs(['*****@*****.**', 'api-key-sir', $curlRequestMock])->getMock(); $connectionMock->expects($spy = $this->any())->method('debug'); $options = new Search(); $options->setName('the-name')->setToDate(new \DateTime('10/12/2015')); $connectionMock->request($options); $invocations = $spy->getInvocations(); $this->assertCount(6, $invocations); $this->assertEquals('Url: https://api.madmimi.com/promotions/search.xml?username=test%40email.com&api_key=api-key-sir&name=the-name&to_date=2015-10-12+00%3A00%3A00&date=1', $invocations[2]->parameters[0]); }
public function testEndPoint() { $options = new Search(); $this->assertEquals('/promotions/search.xml', $options->getEndPoint()); }