コード例 #1
0
 public function testAllowsPropertyChange()
 {
     $mocks = [];
     foreach (['primary', 'secondary'] as $key) {
         $class = ucfirst($key) . 'AuthenticationProvider';
         $mocks[$key] = $this->getMockForAbstractClass("MediaWiki\\Auth\\{$class}", [], "Mock{$class}");
         $mocks[$key]->expects($this->any())->method('getUniqueId')->will($this->returnValue($key));
         $mocks[$key]->expects($this->any())->method('providerAllowsPropertyChange')->will($this->returnCallback(function ($prop) use($key) {
             return $prop !== $key;
         }));
     }
     $this->primaryauthMocks = [$mocks['primary']];
     $this->secondaryauthMocks = [$mocks['secondary']];
     $this->initializeManager(true);
     $this->assertTrue($this->manager->allowsPropertyChange('foo'));
     $this->assertFalse($this->manager->allowsPropertyChange('primary'));
     $this->assertFalse($this->manager->allowsPropertyChange('secondary'));
 }