Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
 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'));
 }
Esempio n. 3
0
 /**
  * @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);
 }
Esempio n. 4
0
 /**
  * @return CM_Model_Splittest
  */
 public function getSplittest()
 {
     return CM_Model_Splittest::findId($this->_getSplittestId());
 }