public function testUpdateTemplate() { $container = $responses = []; $template = $this->templateConfiguration; $template['html'] = '<html><body>Yay it was changed.</body></html>'; $responses[] = new Response(200, [], json_encode($template)); $client = $this->getClient($container, $responses); $api = new KlaviyoApi($client, $this->apiKey); $template_service = new TemplateService($api); $template = TemplateModel::create($this->templateConfiguration); $template->html = '<html><body>Yay it was changed.</body></html>'; $response = $template_service->updateTemplate($template); $this->assertEquals($template, $response); }
/** * Register all services with the continer. */ protected function registerServices(Container $container) { $container['api'] = function ($c) { return KlaviyoApi::create($c['api_key']); }; $container['campaign'] = function ($c) { return CampaignService::create($c['api']); }; $container['lists'] = function ($c) { return ListService::create($c['api']); }; $container['person'] = function ($c) { return PersonService::create($c['api']); }; $container['template'] = function ($c) { return TemplateService::create($c['api']); }; $container['track'] = function ($c) { return TrackService::create($c['api']); }; return $container; }