Пример #1
0
<?php

/**
 * @author tokushima
 * 
 * GETリクエスト
 */
$b = new \ebi\Browser();
$b->do_get(url('index::template_abc'));
$explode_head = $b->explode_head();
eq(true, !empty($explode_head));
eq(true, is_array($explode_head));
$head = $b->head();
eq(true, !empty($head));
eq(true, is_string($head));
Пример #2
0
<?php

$b = new \ebi\Browser();
$b->vars('abc', 123);
$b->vars('def', 456);
$b->do_json(url('index::http_method_vars') . '?xyz=789');
eq('{"abc":123,"def":456}', \ebi\Json::decode($b->body())['result']['raw']);
$b = new \ebi\Browser();
$b->vars('abc', 123);
$b->vars('def', 456);
$b->do_post(url('index::http_method_vars') . '?xyz=789');
eq(123, $b->json('result/post/abc'));
eq(456, $b->json('result/post/def'));
try {
    $b->json('result/post/xyz');
    fail();
} catch (\ebi\exception\NotFoundException $e) {
}
$b = new \ebi\Browser();
$b->vars('abc', 123);
$b->vars('def', 456);
$b->do_get(url('index::http_method_vars') . '?xyz=789');
eq(123, $b->json('result/get/abc'));
eq(456, $b->json('result/get/def'));
eq(789, $b->json('result/get/xyz'));
Пример #3
0
<?php

$b = new \ebi\Browser();
$b->do_get(url('index::form1'));
$b->vars('id1', 'abc');
\ebi\HtmlForm::submit($b);
meq('ID1=abc', $b->body());
$b->vars('id2', 'def');
\ebi\HtmlForm::submit($b, 'next_form');
meq('ID2=def', $b->body());
$b->vars('id3', 'ghi');
\ebi\HtmlForm::submit($b);
meq('ID3=ghi', $b->body());
$b->do_get(url('index::form_select'));
meq('<select name="data_id"><option value="10">AAA</option><option value="20" selected="selected">BBB</option><option value="30">CCC</option></select>', $b->body());
$b->do_get(url('index::form_select_obj'));
meq('<select name="data_id"><option value="10">AAA</option>
<option value="20" selected="selected">BBB</option>
<option value="30">CCC</option>
</select>', $b->body());