model = new Status(); // Пустое значение недопустимо $this->model->name = NULL; $this->assertFalse($this->model->validate([ 'name' ])); } public function testEnterAbove100() { $this->model = new Status(); // Больше 100 символов недопустимо $this->model->name = '**** ' . str_repeat('a', 100) . ' ****'; $this->assertFalse($this->model->validate([ 'name' ])); } public function testEnterData() { $this->model = new Status(); $validName = '--TEST STATUS--'; // Допустимая комбинация $this->model->name = $validName; $this->assertTrue($this->model->validate([ 'name' ])); // Сохранение данных в базу $this->assertTrue($this->model->save()); $count = count(Status::find()->where([ 'name' => $validName ])->all()); $this->assertGreaterThan(0, $count); $this->assertEquals(1, $count); } }