All you need is extend BaseCommand and in test method write your logic for parsing string and then write your data to $ - $.yourKey = yourData
Because $ is object its passing by reference, not by value, so that object will be passed to your controller then