public function testAdd() { $email = '*****@*****.**'; $file_name = getenv('HOME') . "/.terminus/tokens/{$email}"; exec("rm {$file_name}"); $this->tokens_cache->add(compact('email')); $contents = retrieveOutput($file_name); exec("rm {$file_name}"); $this->assertTrue(strpos($contents, $email) !== false); }
public function testSetLogger() { // This test assumes that the debug output defaults to off. $file_name = getLogFileName(); $message = 'The sky is the daily bread of the eyes.'; setOutputDestination($file_name); $this->runner->getLogger()->debug($message); $output = retrieveOutput($file_name); $this->assertFalse(strpos($output, $message) !== false); $this->runner->setLogger(['debug' => true, 'format' => 'json']); $this->runner->getLogger()->debug($message); $output = retrieveOutput($file_name); $this->assertTrue(strpos($output, $message) !== false); resetOutputDestination($file_name); }
public function testLaunchSelf() { $file_name = '/tmp/output'; //Testing the library route setOutputDestination($file_name); $return = $this->launch_helper->launchSelf(['command' => "art unicorn > {$file_name}"]); $output = retrieveOutput($file_name); $this->assertTrue(strpos($output, "<.'_.''") !== false); $this->assertEquals($return, 0); resetOutputDestination($file_name); //Testing the command-line route setOutputDestination($file_name); $GLOBALS['argv'] = [__DIR__ . '/../../../php/boot-fs.php']; $return = $this->launch_helper->launchSelf(['command' => "art unicorn > {$file_name}"]); $output = retrieveOutput($file_name); $this->assertTrue(strpos($output, "<.'_.''") !== false); $this->assertEquals($return, 0); resetOutputDestination($file_name); }
public function testRender() { $this->completions->render(); $output = retrieveOutput(); $this->assertTrue(strpos($output, '--format=') !== false); }