Skip to content

Commit a3a1b9a

Browse files
committed
Merge pull request browserstack#4 from browserstack/force_proxy
force proxy
2 parents e04401b + c8052d0 commit a3a1b9a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/Local.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public function add_args($arg_key, $value = NULL) {
5858
$this->proxy_user = "-proxyUser $value";
5959
elseif ($arg_key == "proxyPass")
6060
$this->proxy_pass = "-proxyPass $value";
61+
elseif ($arg_key == "forceproxy")
62+
$this->force_proxy_flag = "-forceproxy";
6163
elseif ($arg_key == "hosts")
6264
$this->hosts = $value;
6365
elseif ($arg_key == "f") {
@@ -136,7 +138,7 @@ public function command() {
136138
if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
137139
$exec = "call";
138140

139-
$command = "$exec $this->binary_path -logFile $this->logfile $this->folder_flag $this->key $this->folder_path $this->force_local_flag $this->local_identifier_flag $this->only_flag $this->only_automate_flag $this->proxy_host $this->proxy_port $this->proxy_user $this->proxy_pass $this->force_flag $this->verbose_flag $this->hosts";
141+
$command = "$exec $this->binary_path -logFile $this->logfile $this->folder_flag $this->key $this->folder_path $this->force_local_flag $this->local_identifier_flag $this->only_flag $this->only_automate_flag $this->proxy_host $this->proxy_port $this->proxy_user $this->proxy_pass $this->force_proxy_flag $this->force_flag $this->verbose_flag $this->hosts";
140142
$command = preg_replace('/\s+/S', " ", $command);
141143
return $command;
142144
}

tests/LocalTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ public function test_set_proxy() {
6363
$this->assertContains('-proxyHost localhost -proxyPort 8080 -proxyUser user -proxyPass pass',$this->bs_local->command());
6464
}
6565

66+
public function test_enable_force_proxy() {
67+
$this->bs_local->add_args("forceproxy");
68+
$this->assertContains('-forceproxy',$this->bs_local->command());
69+
}
70+
71+
6672
public function test_hosts() {
6773
$this->bs_local->add_args("hosts", "localhost,8080,0");
6874
$this->assertContains('localhost,8080,0',$this->bs_local->command());

0 commit comments

Comments
 (0)