public function testGetHtmlInvalidAdapter() { $site = $this->getMockSite(); CM_Config::get()->CM_Adprovider->enabled = true; CM_Config::get()->CM_Adprovider->zones = array('foo' => array('adapter' => 'CM_AdproviderAdapter_Nonexistent')); $adprovider = new CM_Adprovider(); try { $adprovider->getHtml($site, 'foo'); $this->fail('No exception for invalid ad adapter'); } catch (CM_Exception_Invalid $e) { $this->assertContains('Invalid ad adapter', $e->getMessage()); } }
public function testGetHtmlMissingConfig() { $site = $this->getMockSite(); CM_Config::get()->CM_Adprovider->enabled = true; $adprovider = new CM_Adprovider(); $exception = $this->catchException(function () use($adprovider, $site) { $adprovider->getHtml($site, 'foo'); }); $this->assertInstanceOf('CM_Exception_Invalid', $exception); /** @var CM_Exception_Invalid $exception */ $this->assertSame('Zone not configured.', $exception->getMessage()); $this->assertSame(['zoneName' => 'foo'], $exception->getMetaInfo()); }