/
BootstrapTest.php
47 lines (38 loc) · 1.01 KB
/
BootstrapTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @version $Id$
*/
/**
* @see AbstractTest
*/
require_once 'src/test/AbstractTest.php';
/**
* @see phpRack_Runner
*/
require_once PHPRACK_PATH . '/Runner.php';
class BootstrapTest extends AbstractTest
{
public function testBootstrapIsRendered()
{
ob_start();
include PHPRACK_PATH . '/bootstrap.php';
$result = ob_get_clean();
$this->assertFalse(empty($result));
}
public function testHttpGetRequestDeliversValidJSON()
{
global $phpRackConfig;
$runner = new phpRack_Runner($phpRackConfig);
$tests = $runner->getTests();
$this->assertTrue(count($tests) > 1, 'too few tests, why?');
// get one random test
shuffle($tests);
$test = array_shift($tests);
$_GET[PHPRACK_AJAX_TAG] = $test->getFileName();
$_GET[PHPRACK_AJAX_TOKEN] = 'token';
ob_start();
include PHPRACK_PATH . '/bootstrap.php';
$result = ob_get_clean();
$this->assertFalse(empty($result));
}
}