Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
10582 lgm 1
<?php
2
 
3
class Install_test extends Spark_test_case {
4
 
5
    function test_install_with_version()
6
    {
7
        $clines = $this->capture_buffer_lines(function($cli) {
8
            $cli->execute('install', array('-v1.0', 'example-spark'));
9
        });
10
        $success = (bool) (strpos(end($clines), chr(27) . '[1;36m[ SPARK ]' .
11
            chr(27) . '[0m Spark installed') === 0);
12
        Spark_utils::remove_full_directory(SPARK_PATH . '/example-spark');
13
        $this->assertEquals(true, $success);
14
    }
15
 
16
    function test_install_without_version()
17
    {
18
        $clines = $this->capture_buffer_lines(function($cli) {
19
            $cli->execute('install', array('example-spark'));
20
        });
21
        $success = (bool) (strpos(end($clines), chr(27) . '[1;36m[ SPARK ]' .
22
            chr(27) . '[0m Spark installed') === 0);
23
        Spark_utils::remove_full_directory(SPARK_PATH . '/example-spark');
24
        $this->assertEquals(true, $success);
25
    }
26
 
27
    function test_install_with_invalid_spark()
28
    {
29
        $clines = $this->capture_buffer_lines(function($cli) {
30
            $cli->execute('install', array('jjks7878erHjhsjdkksj'));
31
        });
32
        $success = (bool) (strpos(end($clines), chr(27) . '[1;31m[ ERROR ]' .
33
            chr(27) . '[0m Unable to find spark') === 0);
34
        Spark_utils::remove_full_directory(SPARK_PATH . '/example-spark');
35
        $this->assertEquals(true, $success);
36
    }
37
 
38
    function test_install_with_invalid_spark_version()
39
    {
40
        $clines = $this->capture_buffer_lines(function($cli) {
41
            $cli->execute('install', array('v9.4', 'example-spark'));
42
        });
43
        $success = (bool) (strpos(reset($clines), chr(27) . '[1;31m[ ERROR ]' .
44
            chr(27) . '[0m Uh-oh!') === 0);
45
        Spark_utils::remove_full_directory(SPARK_PATH . '/example-spark');
46
        $this->assertEquals(true, $success);
47
    }
48
 
49
}