0
|
1 <?php
|
|
2
|
|
3 namespace Abraham\TwitterOAuth\Tests;
|
|
4
|
|
5 use Abraham\TwitterOAuth\SignatureMethod;
|
|
6
|
|
7 abstract class AbstractSignatureMethodTest extends \PHPUnit_Framework_TestCase
|
|
8 {
|
|
9 protected $name;
|
|
10
|
|
11 /**
|
|
12 * @return SignatureMethod
|
|
13 */
|
|
14 abstract public function getClass();
|
|
15
|
|
16 abstract protected function signatureDataProvider();
|
|
17
|
|
18 public function testGetName()
|
|
19 {
|
|
20 $this->assertEquals($this->name, $this->getClass()->getName());
|
|
21 }
|
|
22
|
|
23 /**
|
|
24 * @dataProvider signatureDataProvider
|
|
25 */
|
|
26 public function testBuildSignature($expected, $request, $consumer, $token)
|
|
27 {
|
|
28 $this->assertEquals($expected, $this->getClass()->buildSignature($request, $consumer, $token));
|
|
29 }
|
|
30
|
|
31 protected function getRequest()
|
|
32 {
|
|
33 return $this->getMockBuilder('Abraham\TwitterOAuth\Request')
|
|
34 ->disableOriginalConstructor()
|
|
35 ->getMock();
|
|
36 }
|
|
37
|
|
38 protected function getConsumer($key = null, $secret = null, $callbackUrl = null)
|
|
39 {
|
|
40 return $this->getMockBuilder('Abraham\TwitterOAuth\Consumer')
|
|
41 ->setConstructorArgs([$key, $secret, $callbackUrl])
|
|
42 ->getMock();
|
|
43 }
|
|
44
|
|
45 protected function getToken($key = null, $secret = null)
|
|
46 {
|
|
47 return $this->getMockBuilder('Abraham\TwitterOAuth\Token')
|
|
48 ->setConstructorArgs([$key, $secret])
|
|
49 ->getMock();
|
|
50 }
|
|
51 }
|