Exemple #1
0
 /**
  * Registers services on the given container.
  *
  * This method should only be used to configure services and parameters.
  * It should not get services.
  *
  * @param Container $pimple A container instance
  */
 public function register(Container $pimple)
 {
     $pimple['js'] = function ($pimple) {
         $js = new Js($pimple['access_token']);
         $js->setCache($pimple['cache']);
         return $js;
     };
 }
 private function registerJs()
 {
     $this->app->singleton('wechat.js', function () {
         $js = new Js(app('wechat.accesstoken'));
         $js->setCache(app('wechat.cache'));
         return $js;
     });
 }
Exemple #3
0
 /**
  * Test setUrl().
  */
 public function testSetUrl()
 {
     $http = $this->getMockHttp();
     $cache = $this->getMockCache();
     $accessToken = $this->getMockAccessToken();
     $js = new Js($accessToken, $cache);
     $js->setHttp($http);
     $js->setUrl('http://easywechat.org');
     $this->assertEquals('http://easywechat.org', $js->getUrl());
     $accessToken = $this->getMockAccessToken();
     $js = new Js($accessToken, $cache);
     $js->setHttp($http);
     $this->assertEquals('http://current.org', $js->getUrl());
 }