/** * Validate theme data * * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ protected function _validate() { if (!$this->_validator->validate($this)) { $messages = $this->_validator->getErrorMessages(); throw new \Magento\Framework\Exception\LocalizedException(__(implode(PHP_EOL, reset($messages)))); } return $this; }
/** * @test * @return void */ public function testValidatePass() { $this->validator->expects($this->once())->method('validate')->with($this->_model)->willReturn(true); $this->assertInstanceOf(get_class($this->_model), $this->_model->beforeSave()); }