Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | namespace OAuth2\Storage; |
| 4 | |
| 5 | class DynamoDBTest extends BaseTest |
| 6 | { |
| 7 | public function testGetDefaultScope() |
| 8 | { |
| 9 | $client = $this->getMockBuilder('\Aws\DynamoDb\DynamoDbClient') |
| 10 | ->disableOriginalConstructor() |
| 11 | ->setMethods(array('query')) |
| 12 | ->getMock(); |
| 13 | |
| 14 | $return = $this->getMockBuilder('\Guzzle\Service\Resource\Model') |
| 15 | ->setMethods(array('count', 'toArray')) |
| 16 | ->getMock(); |
| 17 | |
| 18 | $data = array( |
| 19 | 'Items' => array(), |
| 20 | 'Count' => 0, |
| 21 | 'ScannedCount'=> 0 |
| 22 | ); |
| 23 | |
| 24 | $return->expects($this->once()) |
| 25 | ->method('count') |
| 26 | ->will($this->returnValue(count($data))); |
| 27 | |
| 28 | $return->expects($this->once()) |
| 29 | ->method('toArray') |
| 30 | ->will($this->returnValue($data)); |
| 31 | |
| 32 | // should return null default scope if none is set in database |
| 33 | $client->expects($this->once()) |
| 34 | ->method('query') |
| 35 | ->will($this->returnValue($return)); |
| 36 | |
| 37 | $storage = new DynamoDB($client); |
| 38 | $this->assertNull($storage->getDefaultScope()); |
| 39 | } |
| 40 | } |