예제 #1
0
 public function testValid()
 {
     $_GET = array('timestamp' => 1397911023, 'nonce' => 2056994866, 'signature' => 'f97c166a920dc3196fadb9e668ed91ed8a593bfe');
     $request = new Wechat\Request('token');
     $this->assertTrue($request->valid());
     $request = new Wechat\Request('error');
     $this->assertFalse($request->valid());
 }
예제 #2
0
 public function testCreateUrl()
 {
     $client = new Wechat\Client('http://example.com', 'token');
     $url = parse_url($client->createUrl());
     parse_str($url['query'], $url['query']);
     $this->assertEquals(Wechat\Request::createSignature($client->token, $url['query']['timestamp'], $url['query']['nonce']), $url['query']['signature']);
 }