我今天开始在 PhpStorm 上使用 PHPUnit 测试。我可以测试几乎所有的功能,除了需要数据库连接的功能。
功能:
public function getProductID()
{
$this->product_id = $this->db->GetOne("select product_id from table1 where id = {$this->id}");
return $this->product_id['product_id'];
}
Run Code Online (Sandbox Code Playgroud)
在我的测试用例中,出现错误:
PHP 致命错误:在 null 上调用成员函数 GetOne()
我已经定义:
global $_db;
$this->db = $_db;
Run Code Online (Sandbox Code Playgroud) 我正在尝试将一些 Markdown 文本发送到其余 api。刚才我发现 json 中不接受换行符。
\n\n例子。如何将其发送到我的 api:
\n\nAn h1 header\n============\n\nParagraphs are separated by a blank line.\n\n2nd paragraph. *Italic*, **bold**, and `monospace`. Itemized lists\nlook like:\n\n * this one\n * that one\n * the other one\n\nNote that --- not considering the asterisk --- the actual text\ncontent starts at 4-columns in.\n\n> Block quotes are\n> written like so.\n>\n> They can span multiple paragraphs,\n> if you like.\n\nUse 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it\'s all\nin chapters 12--14"). …Run Code Online (Sandbox Code Playgroud)