/** * View Pantheon ASCII artwork * * ## OPTIONS * <druplicon|fist|unicorn|wordpress> */ function __invoke($args, $assoc_args) { $artwork = $this->works[array_rand($this->works)]; if (count($args) > 0) { $artwork = array_shift($args); } try { $artwork_content = Utils\loadAsset("{$artwork}.txt"); $this->output()->line($this->colorize("%g" . base64_decode($artwork_content) . "%n")); } catch (TerminusException $e) { $this->failure('There is no source for the requested "{artwork}" artwork.', compact('artwork')); } }
public function testLoadAsset() { $file = Utils\loadAsset('unicorn.txt'); $this->assertTrue(strpos($file, 'ICAgICAg') === 0); try { $invalid_file = Utils\loadAsset('invalid'); } catch (\Exception $e) { $message = $e->getMessage(); } $this->assertTrue(isset($message)); }