/** * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage The file 'File Title' for 'Option Title' has an invalid extension. */ public function testValidateWithInvalidFile() { $relativePath = '/custom_options/quote/file'; $optionValues = ['quote_path' => '/custom_options/quote/file', 'title' => 'File Title']; $this->prepare(); $this->directoryRead->expects($this->once())->method('isReadable')->with($relativePath)->willReturn(false); $this->option->expects($this->once())->method('getTitle')->willReturn('Option Title'); $this->zendValidator->expects($this->at(2))->method('getErrors')->willReturn(true); $this->zendValidator->expects($this->at(3))->method('getErrors')->willReturn([\Zend_Validate_File_ExcludeExtension::FALSE_EXTENSION]); $this->validator->validate($optionValues, $this->option); }