public function testRemoveForCompositePrimaryKey() { $this->specify('Remove a AR with composite primary key', function () { /*UserDepartmentAssignment::deleteAll(['userId' => 300,'departmentId'=>99]); $depart = new UserDepartmentAssignment(); $depart->userId = 300; $depart->departmentId = 99; $depart->save(false);*/ $controller = new ActiveController('user-department-assignments', Yii::$app, ['modelClass' => 'tests\\codeception\\unit\\models\\base\\UserDepartmentAssignment']); $action = new DeleteAction("remove", null, ['modelClass' => 'tests\\codeception\\unit\\models\\base\\UserDepartmentAssignment']); $action->controller = $controller; $action->runWithParams(['id' => '{"userId": 300,"departmentId" : 99}']); $model = UserDepartmentAssignment::findOne(['userId' => 300, 'departmentId' => 99]); expect("The result of findOne() after deleting should be null: ", $model)->null(); }, ['throws' => ['yii\\web\\NotFoundHttpException']]); }