コード例 #1
0
 /**
  * @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');
 }
コード例 #2
0
 public function setUp()
 {
     $this->mock = $this->getMock(ActiveRecord::class, ['save', 'hasAttribute', 'getIsNewRecord', 'setAttribute']);
     $this->mock->attachBehavior('bl', ['class' => BlameableBehavior::class]);
 }
コード例 #3
0
 public function setUp()
 {
     $this->mock = $this->getMock(ActiveRecord::class, ['save', 'hasAttribute', 'getIsNewRecord', 'setAttribute']);
     $this->mock->attachBehavior('ts', ['class' => TimestampBehavior::class, 'createdAtAttribute' => 'cr', 'updatedAtAttribute' => 'up']);
 }
コード例 #4
0
 /**
  * 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);
         }
     }
 }
コード例 #5
0
ファイル: Module.php プロジェクト: vladdnepr/yii2-ycm
 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;
 }
コード例 #6
0
 public function setUp()
 {
     $this->mock = $this->getMock(ActiveRecord::class, ['save', 'validate']);
     $this->mock->attachBehavior('safeSaver', SafeSaverBehaviour::class);
 }