public function testCreateStandard() { $data = ['long_url' => 'http://www.vg.no', 'user_defined' => true]; $model = \ArkonEvent\ApiClient\Models\Factory::getInstance(AccountAPIClient::TYPE_SHORT_URLS, $data); $shortUrl = $this->sdk->createFromModel($model); $this->assertEquals($data['long_url'], $shortUrl->getLongUrl()); $this->assertNotEmpty($shortUrl->getShortUrl()); $this->assertContains('http://', $shortUrl->getShortUrl()); $this->assertTrue($shortUrl->isUserDefined()); // re-run to ensure same url is given $shortUrl2 = $this->sdk->createFromModel($model); $this->assertEquals($shortUrl2->getShortUrl(), $shortUrl->getShortUrl()); }
/** * Get an array of models * * @param string $type * @param array $includes * @param array $filters * @return [] */ public function getModels($type, array $includes = [], array $filters = [], array $paging = [], array $sorting = []) { $documents = $this->getAll($type, $includes, $filters, $paging, $sorting); $result = []; foreach ($documents as $item) { $result[] = Models\Factory::getInstanceFromItem($type, $item); } return $result; }