public function iAttachTheFileToTheCurrentDropZone($path)
{
if ($this->getMinkParameter('files_path')) {
$fullPath = rtrim(realpath($this->getMinkParameter('files_path')), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR);
} else {
$fullPath = __DIR__ . DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR);
}
if (!is_file($fullPath)) {
throw new \InvalidArgumentException(sprintf('File doesn\'t exist (%s)', $fullPath));
}
$fields = $this->getSession()->getPage()->findAll('css', 'input[type="file"]');
if (count($fields) == 0) {
throw new ElementNotFoundException($this->getSession(), 'drop-zone upload field');
}
/** @var NodeElement $field */
$field = end($fields);
$field->attachFile($fullPath);
}