Пример #1
0
 function export()
 {
     $finder = new VF_Note_Finder();
     $result = '"id","code","message"';
     $result .= "\n";
     foreach ($finder->getAllNotes() as $note) {
         $result .= '"' . $note->id . '"';
         $result .= ',';
         $result .= '"' . $note->code . '"';
         $result .= ',';
         $result .= '"' . $note->message . '"';
         $result .= "\n";
     }
     return $result;
 }
Пример #2
0
 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');
 }