コード例 #1
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['sort' => ['class' => ContinuousNumericalSortableBehavior::className(), 'scope' => function () {
         return ContinuousQuestion::find()->where(['test_id' => $this->test_id]);
     }, 'sortableCondition' => ['is_active' => 1]]];
 }
コード例 #2
0
 /**
  * @param integer $testId
  * @param array $ids
  */
 protected function checkOtherTestQuestions($testId, $ids = [1, 2, 3, 4, 5])
 {
     $questions = ContinuousQuestion::find()->where(['test_id' => $testId])->orderBy(['id' => SORT_ASC])->all();
     $questionsSort = ArrayHelper::getColumn($questions, 'sort');
     $this->assertEquals($ids, $questionsSort, 'Other scope models sort matches');
 }