Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
10582 lgm 1
<?php
2
 
3
define('SPARK_PATH', __DIR__ . '/test-sparks');
4
 
5
require __DIR__ . '/../../lib/spark/spark_cli.php';
6
 
7
class Spark_test_case extends PHPUnit_Framework_TestCase {
8
 
9
    function setUp()
10
    {
11
        $this->source_names[] = 'getsparks.org';
12
        $this->sources = array_map(function($n) {
13
            return new Spark_source($n);
14
        }, $this->source_names);
15
        $this->cli = new Spark_CLI($this->sources);
16
    }
17
 
18
    function tearDown()
19
    {
20
        if (is_dir(SPARK_PATH . '/example-spark'))
21
        {
22
            Spark_utils::remove_full_directory(SPARK_PATH . '/example-spark');
23
        }
24
    }
25
 
26
    protected function capture_buffer_lines($func) {
27
        ob_start();
28
        $func($this->cli); 
29
        $t = ob_get_contents();
30
        ob_end_clean();
31
        if ($t == '') return array(); // empty
32
        return explode("\n", substr($t, 0, count($t) - 2));
33
    }
34
}