blob: 2147f0914d3c5e5f30882d35267c0261ff201d88 [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001<?php
2
3namespace OAuth2\Storage;
4
5class 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}