Skip to content

Commit

Permalink
Unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sicaboy committed Sep 5, 2018
1 parent f9353f5 commit 7d537d8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 29 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ HTTP_PROXY_CACHE_TTL=300

```php
use Sicaboy\LaravelHttpProxy\Facades\HttpProxy;
// Get a valid proxy. e.g."12.34.56.78:8080"
$proxy = HttpProxy::getProxy();
// Give up the current cached proxy and get another valid proxy
$proxy = HttpProxy::refreshProxy();
```

#### Init js source

### Testing

## Contribute

https://github.com/sicaboy/laravel-http-proxy/pulls
https://github.com/sicaboy/laravel-http-proxy/pulls
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
}
],
"minimum-stability": "dev",
"require": {},
"require": {
"illuminate/support": "5.0.*|5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"autoload": {
"psr-4": {
"Sicaboy\\LaravelHttpProxy\\": "src/"
Expand Down
35 changes: 9 additions & 26 deletions tests/HttpProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,18 @@

class HttpProxyTest extends PHPUnit_Framework_TestCase
{
private $captcha;
private $httpProxy;

public function setUp()
{
parent::setUp();
$this->captcha = new HttpProxy('{secret-key}', '{site-key}');
$this->httpProxy = new HttpProxy('http', '123.207.35.36', 5010, []);
}
public function testProxy()
{
$this->assertTrue($this->httpProxy instanceof HttpProxy);

$isWithPort = ( strpos($this->httpProxy->getProxy(),':') > 0 );
$this->assertTrue($isWithPort);
}
//
// public function testJsLink()
// {
// $this->assertTrue($this->captcha instanceof NoCaptcha);
//
// $simple = '<script src="https://www.google.com/recaptcha/api.js?" async defer></script>'."\n";
// $withLang = '<script src="https://www.google.com/recaptcha/api.js?hl=vi" async defer></script>'."\n";
// $withCallback = '<script src="https://www.google.com/recaptcha/api.js?render=explicit&onload=myOnloadCallback" async defer></script>'."\n";
//
// $this->assertEquals($this->captcha->renderJs(), $simple);
// $this->assertEquals($this->captcha->renderJs('vi'), $withLang);
// $this->assertEquals($this->captcha->renderJs(null, true, 'myOnloadCallback'), $withCallback);
// }
//
// public function testDisplay()
// {
// $this->assertTrue($this->captcha instanceof NoCaptcha);
//
// $simple = '<div class="g-recaptcha" data-sitekey="{site-key}"></div>';
// $withAttrs = '<div class="g-recaptcha" data-theme="light" data-sitekey="{site-key}"></div>';
//
// $this->assertEquals($this->captcha->display(), $simple);
// $this->assertEquals($this->captcha->display(['data-theme' => 'light']), $withAttrs);
// }
}

0 comments on commit 7d537d8

Please sign in to comment.