예제 #1
0
 public function testScopeStorage()
 {
     $scopeUtil = new Scope();
     $this->assertEquals($scopeUtil->getDefaultScope(), null);
     $scopeUtil = new Scope(array('default_scope' => 'default', 'supported_scopes' => array('this', 'that', 'another')));
     $this->assertEquals($scopeUtil->getDefaultScope(), 'default');
     $this->assertTrue($scopeUtil->scopeExists('this that another', 'client_id'));
     $memoryStorage = new Memory(array('default_scope' => 'base', 'supported_scopes' => array('only-this-one')));
     $scopeUtil = new Scope($memoryStorage);
     $this->assertEquals($scopeUtil->getDefaultScope(), 'base');
     $this->assertTrue($scopeUtil->scopeExists('only-this-one', 'client_id'));
 }
예제 #2
0
 /** @dataProvider provideStorage */
 public function testGetDefaultScope($storage)
 {
     if ($storage instanceof NullStorage) {
         $this->markTestSkipped('Skipped Storage: ' . $storage->getMessage());
         return;
     }
     if (!$storage instanceof ScopeInterface) {
         // incompatible storage
         return;
     }
     // test getting default scope
     $scopeUtil = new Scope($storage);
     $this->assertEquals($scopeUtil->getDefaultScope(), 'defaultscope1 defaultscope2');
 }
예제 #3
0
 public function testScopeStorage()
 {
     $scopeUtil = new Scope();
     $this->assertEquals($scopeUtil->getDefaultScope(), null);
     $scopeUtil = new Scope(array('default_scope' => 'default', 'supported_scopes' => array('this', 'that', 'another')));
     $this->assertEquals($scopeUtil->getDefaultScope(), 'default');
     $this->assertTrue($scopeUtil->scopeExists('this that another', 'client_id'));
     $memoryStorage = new Memory(array('default_scope' => 'base', 'supported_scopes' => array('only-this-one')));
     $scopeUtil = new Scope($memoryStorage);
     $this->assertEquals($scopeUtil->getDefaultScope(), 'base');
     $this->assertTrue($scopeUtil->scopeExists('only-this-one', 'client_id'));
     //Test getting default scopes with a client_id
     $memoryStorage = Bootstrap::getInstance()->getMemoryStorage();
     $scopeUtil = new Scope($memoryStorage);
     $this->assertEquals($scopeUtil->getDefaultScope('Test Default Scope Client ID'), 'clientscope1 clientscope2');
     $this->assertEquals($scopeUtil->getDefaultScope('Test Default Scope Client ID 2'), 'clientscope3');
     $this->assertEquals($scopeUtil->getDefaultScope('Test Default Scope Client ID That Does Not Exist'), null);
 }
 /** @dataProvider provideStorage */
 public function testGetDefaultScope($storage)
 {
     if ($storage instanceof NullStorage) {
         $this->markTestSkipped('Skipped Storage: ' . $storage->getMessage());
         return;
     }
     if (!$storage instanceof ScopeInterface) {
         // incompatible storage
         return;
     }
     // test getting default scope
     $scopeUtil = new Scope($storage);
     $expected = explode(' ', $scopeUtil->getDefaultScope());
     $actual = explode(' ', 'defaultscope1 defaultscope2');
     sort($expected);
     sort($actual);
     $this->assertEquals($expected, $actual);
     $this->assertTrue($storage->getDefaultScope('event_stop_propagation'));
 }