public function donttest_single_file() { $phpAnalyzer = new PhpAnalyzer(); $info = $phpAnalyzer->getInfo('Sledgehammer\\Facebook'); \Sledgehammer\dump($info); ob_flush(); }
public function donttest_tokenizer() { $filename = Autoloader::instance()->getFilename('App'); $this->assertEqualTokenizer($filename); try { $tokenizer = new PhpTokenizer(file_get_contents($filename)); $tokens = iterator_to_array($tokenizer); foreach ($tokens as $token) { if (strpos($token[1], '{') !== false) { if ($token[0] != 'T_OPEN_BRACKET' || $token[1] != '{') { \Sledgehammer\dump($token); } } } \Sledgehammer\dump($tokens); ob_flush(); } catch (Exception $e) { \Sledgehammer\report_exception($e); ob_flush(); } }
/** * Controleer of de $sql query is uitgevoerd sinds de start van de test_*(). * * @param string $sql * @param null|string $message Het bericht dat op de testpagina getoond wordt (met een PASS of FAIL ervoor) * * @return bool */ public function assertQuery($sql, $message = null) { if ($message === null) { $message = 'SQL [' . $sql . '] should be executed'; } $db = Connection::instance($this->dbLink); $entries = array_slice($db->logger->entries, $this->queryCount); // Haal de queries uit de query_log die sinds de setUp() van deze test_*() zijn uitgevoert $queries = []; foreach ($entries as $row) { $queries[] = (string) $row[0]; } foreach ($queries as $query) { if ($sql == $query) { $this->assertTrue(true, $message); return true; } } if ($this->debug) { \Sledgehammer\dump($queries); } $this->fail($message); }
/** * Translates the int to the token_name (371 => T_WHITESPACE) and dumps the result. * * @param array|string $token */ private function dump($token) { if (is_array($token)) { $token[0] = token_name($token[0]); } \Sledgehammer\dump($token); }
/** * Dumps information about a variable, like var_dump() but with improved syntax and coloring. * * @param mixed $variable * @param bool $export * * @return string|void */ function dump($variable, $export = false) { return Sledgehammer\dump($variable, $export); }