protected function assertParse($from, $to, $message = null) { if (is_null($message)) { $message = "Sbp::parse(\"{$from}\") do not return \"{$to}\""; } $explode = explode("\n", $parsed = Sbp::parse("<?\n" . $from), 2); $from = str_replace(array("\n", "\r", "\t", ' '), '', trim(end($explode))); $to = str_replace(array("\n", "\r", "\t", ' '), '', trim($to)); return $this->assertSame($from, $to, $message . ", it return\"{$parsed}\"\n\n"); }
public function testPluginNotCallable() { $message = ''; try { sbp_add_plugin('foo3', 'not_callable'); Sbp::parse("<?\necho 'Hello'"); } catch (SbpException $e) { $message = $e->getMessage(); } $this->assertTrue(strpos($message, 'callable') !== false); sbp_remove_plugin('foo3'); }