function guts() { if (isset($_FILES['file']['error']) && $_FILES['file']['error'] === 0) { $importer = new VF_Note_Import($_FILES['file']['tmp_name']); $importer->import(); $this->block->messages = 'Done'; } }
function testImportUpdatesMessage() { $csvData = "code,message\ncode1,message1\n"; $csvFile = TEMP_PATH . '/notes-definitions.csv'; file_put_contents($csvFile, $csvData); $import = new VF_Note_Import($csvFile); $csv = $import->import(); $csvData = "code,message\ncode1,message-new\n"; $csvFile = TEMP_PATH . '/notes-definitions.csv'; file_put_contents($csvFile, $csvData); $import = new VF_Note_Import($csvFile); $csv = $import->import(); $finder = new VF_Note_Finder(); $actual = $finder->getAllNotes(); $this->assertEquals('message-new', $actual[0]->message, 'should be able to update note message with importer'); }