public function testTokenExistsForEmail() { $tokens_cache = new TokensCache(); $tokens_dir = $tokens_cache->getCacheDir(); $creds = getBehatCredentials(); $file_name = $tokens_dir . '/' . $creds['username']; setOutputDestination($file_name); $this->assertTrue($this->auth->tokenExistsForEmail($creds['username'])); resetOutputDestination($file_name); $this->assertFalse($this->auth->tokenExistsForEmail('invalid')); }
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 testRemove() { $file_name = $this->getFileName(); setOutputDestination($file_name); $removed = $this->file_cache->remove($this->test_file_name); $this->assertTrue($removed); $removed = $this->file_cache->remove($this->test_file_name); $this->assertFalse($removed); }
public function testLoadFile() { $file_name = '/tmp/testfile'; setOutputDestination($file_name); Utils\loadFile($file_name); resetOutputDestination($file_name); $included_files = get_included_files(); $is_included = array_search($file_name, $included_files) !== false || array_search("/private{$file_name}", $included_files) !== false; $this->assertTrue($is_included); }