public function testGetSetEnabled() { /** @var CM_Model_SplittestVariation $variation1 */ $variation1 = $this->_test->getVariations()->getItem(0); /** @var CM_Model_SplittestVariation $variation2 */ $variation2 = $this->_test->getVariations()->getItem(0); $this->assertTrue($variation1->getEnabled()); $this->assertTrue($variation2->getEnabled()); $variation1->setEnabled(false); $this->assertFalse($variation1->getEnabled()); $variation1->setEnabled(true); $this->assertTrue($variation1->getEnabled()); $variation1->setEnabled(false); try { $variation2->setEnabled(false); $this->fail('Could disable all variations'); } catch (CM_Exception $e) { $this->assertTrue(true); } }
public function testExists() { $this->assertFalse(CM_Model_Splittest::exists('foo')); $splittest = CM_Model_Splittest::create('foo', ['bar']); $this->assertTrue(CM_Model_Splittest::exists('foo')); $splittest->delete(); $this->assertFalse(CM_Model_Splittest::exists('foo')); }
/** * @param CM_Model_Splittest $splittest */ public function __construct(CM_Model_Splittest $splittest) { $source = new CM_PagingSource_Sql('id', 'cm_splittestVariation', '`splittestId`=' . $splittest->getId()); $source->enableCacheLocal(86400); parent::__construct($source); }
/** * @return CM_Model_Splittest */ public function getSplittest() { return CM_Model_Splittest::findId($this->_getSplittestId()); }