Skip to content

Commit 37bbcc2

Browse files
committed
args
1 parent a3a1b9a commit 37bbcc2

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
$me = new Local();
1212
$me->isRunning();
1313
echo "starting";
14-
$args = array("v" => 1);
14+
$args = array("-v" => 1);
1515
$me->start($args);
1616
echo "started";
1717
echo $me->isRunning();

lib/Local.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,37 @@ public function isRunning() {
3232
}
3333

3434
public function add_args($arg_key, $value = NULL) {
35-
if ($arg_key == "key")
35+
if ($arg_key == "-key")
3636
$this->key = $value;
37-
elseif ($arg_key == "binaryPath")
37+
elseif ($arg_key == "-binaryPath")
3838
$this->binary_path = $value;
39-
elseif ($arg_key == "logfile")
39+
elseif ($arg_key == "-logfile")
4040
$this->logfile = $value;
41-
elseif ($arg_key == "v")
41+
elseif ($arg_key == "-v")
4242
$this->verbose_flag = "-vvv";
43-
elseif ($arg_key == "force")
43+
elseif ($arg_key == "-force")
4444
$this->force_flag = "-force";
45-
elseif ($arg_key == "only")
45+
elseif ($arg_key == "-only")
4646
$this->only_flag = "-only";
47-
elseif ($arg_key == "onlyAutomate")
47+
elseif ($arg_key == "-onlyAutomate")
4848
$this->only_automate_flag = "-onlyAutomate";
49-
elseif ($arg_key == "forcelocal")
49+
elseif ($arg_key == "-forcelocal")
5050
$this->force_local_flag = "-forcelocal";
51-
elseif ($arg_key == "localIdentifier")
51+
elseif ($arg_key == "-localIdentifier")
5252
$this->local_identifier_flag = "-localIdentifier $value";
53-
elseif ($arg_key == "proxyHost")
53+
elseif ($arg_key == "-proxyHost")
5454
$this->proxy_host = "-proxyHost $value";
55-
elseif ($arg_key == "proxyPort")
55+
elseif ($arg_key == "-proxyPort")
5656
$this->proxy_port = "-proxyPort $value";
57-
elseif ($arg_key == "proxyUser")
57+
elseif ($arg_key == "-proxyUser")
5858
$this->proxy_user = "-proxyUser $value";
59-
elseif ($arg_key == "proxyPass")
59+
elseif ($arg_key == "-proxyPass")
6060
$this->proxy_pass = "-proxyPass $value";
61-
elseif ($arg_key == "forceproxy")
61+
elseif ($arg_key == "-forceproxy")
6262
$this->force_proxy_flag = "-forceproxy";
63-
elseif ($arg_key == "hosts")
63+
elseif ($arg_key == "-hosts")
6464
$this->hosts = $value;
65-
elseif ($arg_key == "f") {
65+
elseif ($arg_key == "-f") {
6666
$this->folder_flag = "-f";
6767
$this->folder_path = $value;
6868
}

tests/LocalTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,82 +21,82 @@ public function tearDown(){
2121
}
2222

2323
public function test_verbose() {
24-
$this->bs_local->add_args('v');
24+
$this->bs_local->add_args('-v');
2525
$this->assertContains('-v',$this->bs_local->command());
2626
}
2727

2828
public function test_set_folder() {
29-
$this->bs_local->add_args('f', "/");
29+
$this->bs_local->add_args('-f', "/");
3030
$this->assertContains('-f',$this->bs_local->command());
3131
$this->assertContains('/',$this->bs_local->command());
3232
}
3333

3434
public function test_enable_force() {
35-
$this->bs_local->add_args("force");
35+
$this->bs_local->add_args("-force");
3636
}
3737

3838
public function test_set_local_identifier() {
39-
$this->bs_local->add_args("localIdentifier", "randomString");
39+
$this->bs_local->add_args("-localIdentifier", "randomString");
4040
$this->assertContains('-localIdentifier randomString',$this->bs_local->command());
4141
}
4242

4343
public function test_enable_only() {
44-
$this->bs_local->add_args("only");
44+
$this->bs_local->add_args("-only");
4545
$this->assertContains('-only',$this->bs_local->command());
4646
}
4747

4848
public function test_enable_only_automate() {
49-
$this->bs_local->add_args("onlyAutomate");
49+
$this->bs_local->add_args("-onlyAutomate");
5050
$this->assertContains('-onlyAutomate', $this->bs_local->command());
5151
}
5252

5353
public function test_enable_force_local() {
54-
$this->bs_local->add_args("forcelocal");
54+
$this->bs_local->add_args("-forcelocal");
5555
$this->assertContains('-forcelocal',$this->bs_local->command());
5656
}
5757

5858
public function test_set_proxy() {
59-
$this->bs_local->add_args("proxyHost", "localhost");
60-
$this->bs_local->add_args("proxyPort", 8080);
61-
$this->bs_local->add_args("proxyUser", "user");
62-
$this->bs_local->add_args("proxyPass", "pass");
59+
$this->bs_local->add_args("-proxyHost", "localhost");
60+
$this->bs_local->add_args("-proxyPort", 8080);
61+
$this->bs_local->add_args("-proxyUser", "user");
62+
$this->bs_local->add_args("-proxyPass", "pass");
6363
$this->assertContains('-proxyHost localhost -proxyPort 8080 -proxyUser user -proxyPass pass',$this->bs_local->command());
6464
}
6565

6666
public function test_enable_force_proxy() {
67-
$this->bs_local->add_args("forceproxy");
67+
$this->bs_local->add_args("-forceproxy");
6868
$this->assertContains('-forceproxy',$this->bs_local->command());
6969
}
7070

7171

7272
public function test_hosts() {
73-
$this->bs_local->add_args("hosts", "localhost,8080,0");
73+
$this->bs_local->add_args("-hosts", "localhost,8080,0");
7474
$this->assertContains('localhost,8080,0',$this->bs_local->command());
7575
}
7676

7777
public function test_isRunning() {
7878
$this->assertFalse($this->bs_local->isRunning());
79-
$this->bs_local->start(array('v' => true));
79+
$this->bs_local->start(array('-v' => true));
8080
$this->assertTrue($this->bs_local->isRunning());
8181
$this->bs_local->stop();
8282
$this->assertFalse($this->bs_local->isRunning());
83-
$this->bs_local->start(array('v' => true));
83+
$this->bs_local->start(array('-v' => true));
8484
$this->assertTrue($this->bs_local->isRunning());
8585
}
8686

8787
public function test_checkPid() {
8888
$this->assertFalse($this->bs_local->isRunning());
89-
$this->bs_local->start(array('v' => true));
89+
$this->bs_local->start(array('-v' => true));
9090
$this->assertTrue($this->bs_local->pid > 0);
9191
}
9292

9393
public function test_multiple_binary() {
94-
$this->bs_local->start(array('v' => true));
94+
$this->bs_local->start(array('-v' => true));
9595
$bs_local_2 = new Local();
9696
$log_file2 = getcwd(). '/log2.log';
9797
print($log_file2);
9898
try {
99-
$bs_local_2->start(array('v' => true, 'logfile' => $log_file2));
99+
$bs_local_2->start(array('-v' => true, '-logfile' => $log_file2));
100100
$this->fail("Expected Exception has not been raised.");
101101
} catch (LocalException $ex) {
102102
$emessage = $ex->getMessage();

0 commit comments

Comments
 (0)