/**
  * @test
  */
 public function testRenderDualNotController()
 {
     $controller = new \yii\db\ActiveRecord();
     $controller->attachBehavior('RenderDual', new \yii2renderdual\RenderDual());
     $this->setExpectedException('Exception');
     $render = $controller->renderDual('view', ['foo' => 'bar'], 'foo bar');
 }
 public function setUp()
 {
     $this->mock = $this->getMock(ActiveRecord::class, ['save', 'hasAttribute', 'getIsNewRecord', 'setAttribute']);
     $this->mock->attachBehavior('bl', ['class' => BlameableBehavior::class]);
 }
 public function setUp()
 {
     $this->mock = $this->getMock(ActiveRecord::class, ['save', 'hasAttribute', 'getIsNewRecord', 'setAttribute']);
     $this->mock->attachBehavior('ts', ['class' => TimestampBehavior::class, 'createdAtAttribute' => 'cr', 'updatedAtAttribute' => 'up']);
 }
 /**
  * Send currently signed emails.
  */
 protected function sendSigned()
 {
     while ($fetchedMails = $this->findMailBySignature($this->pageSize)) {
         foreach ($fetchedMails as $this->_fetchedMail) {
             if ($this->sentByBehavior) {
                 $this->_fetchedMail->attachBehavior($this->sentByBehavior->className(), $this->sentByBehavior);
             }
             $msg = $this->assembleMailMessage($this->_fetchedMail);
             $isSent = $this->testMode ? rand(0, 1) : $this->getMailer()->send($msg);
             $this->processEmailStatus($this->_fetchedMail, $isSent);
             $this->_fetchedMail->save(false);
             $this->{$this->useLiteAntiSpams ? "applySpamRulesLite" : "applySpamRules"}(++$this->_sentCount);
         }
     }
 }
Ejemplo n.º 5
0
 public function attachBehaviorsToModel(ActiveRecord $model)
 {
     $model->attachBehavior('datetimepicker', \vladdnepr\ycm\behaviors\DatePickerBehavior::className());
     $model->attachBehavior('relationsseter', \vladdnepr\ycm\behaviors\RelationsBehavior::className());
     $model->attachBehavior('multilang', \vladdnepr\ycm\behaviors\MultilangBehavior::className());
     return $model;
 }
 public function setUp()
 {
     $this->mock = $this->getMock(ActiveRecord::class, ['save', 'validate']);
     $this->mock->attachBehavior('safeSaver', SafeSaverBehaviour::class);
 }