コード例 #1
0
ファイル: tests.php プロジェクト: fstream9/Slash
assert($response['status'] == 'ERROR');
//missing target
echo 'Targeted sentiment tests complete!', PHP_EOL, PHP_EOL;
//Text
echo 'Checking clean text . . . ', PHP_EOL;
$response = $alchemyapi->text('text', $test_text, null);
assert($response['status'] == 'ERROR');
//text only works on html and url content
$response = $alchemyapi->text('html', $test_html, null);
assert($response['status'] == 'OK');
$response = $alchemyapi->text('url', $test_url, null);
assert($response['status'] == 'OK');
echo 'Clean text tests complete!', PHP_EOL, PHP_EOL;
//Text Raw
echo 'Checking raw text . . . ', PHP_EOL;
$response = $alchemyapi->text_raw('text', $test_text, null);
assert($response['status'] == 'ERROR');
//text_raw only works on html and url content
$response = $alchemyapi->text_raw('html', $test_html, null);
assert($response['status'] == 'OK');
$response = $alchemyapi->text_raw('url', $test_url, null);
assert($response['status'] == 'OK');
echo 'Raw text tests complete!', PHP_EOL, PHP_EOL;
//Author
echo 'Checking author . . . ', PHP_EOL;
$response = $alchemyapi->author('text', $test_text, null);
assert($response['status'] == 'ERROR');
//author only works on html and url content
$response = $alchemyapi->author('html', $test_html, null);
assert($response['status'] == 'ERROR');
//there is no author listed in the test HTML content