Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>tags/v18.0.0beta1
Subproject commit 3cf032e948177e2dba40a828aa67d35175cf4bcd | |||||
Subproject commit 4a0dc8066bde4ca5641a740e304f9a5403a5952e |
use OCP\Authentication\TwoFactorAuth\IProvider; | use OCP\Authentication\TwoFactorAuth\IProvider; | ||||
use OCP\Authentication\TwoFactorAuth\IRegistry; | use OCP\Authentication\TwoFactorAuth\IRegistry; | ||||
use OCP\Authentication\TwoFactorAuth\RegistryEvent; | use OCP\Authentication\TwoFactorAuth\RegistryEvent; | ||||
use OCP\EventDispatcher\IEventDispatcher; | |||||
use OCP\IUser; | use OCP\IUser; | ||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface; | |||||
use Symfony\Component\EventDispatcher\GenericEvent; | |||||
class Registry implements IRegistry { | class Registry implements IRegistry { | ||||
/** @var ProviderUserAssignmentDao */ | /** @var ProviderUserAssignmentDao */ | ||||
private $assignmentDao; | private $assignmentDao; | ||||
/** @var EventDispatcherInterface */ | |||||
/** @var IEventDispatcher */ | |||||
private $dispatcher; | private $dispatcher; | ||||
public function __construct(ProviderUserAssignmentDao $assignmentDao, | public function __construct(ProviderUserAssignmentDao $assignmentDao, | ||||
EventDispatcherInterface $dispatcher) { | |||||
IEventDispatcher $dispatcher) { | |||||
$this->assignmentDao = $assignmentDao; | $this->assignmentDao = $assignmentDao; | ||||
$this->dispatcher = $dispatcher; | $this->dispatcher = $dispatcher; | ||||
} | } |
namespace OCP\EventDispatcher; | namespace OCP\EventDispatcher; | ||||
use Symfony\Component\EventDispatcher\GenericEvent; | |||||
use Symfony\Contracts\EventDispatcher\Event as SymfonyEvent; | |||||
/** | /** | ||||
* Base event class for the event dispatcher service | * Base event class for the event dispatcher service | ||||
* | * | ||||
* @since 17.0.0 | * @since 17.0.0 | ||||
*/ | */ | ||||
class Event extends GenericEvent { | |||||
class Event extends SymfonyEvent { | |||||
/** | |||||
* Compatibility constructor | |||||
* | |||||
* In Nextcloud 17.0.0 this event class used a now deprecated/removed Symfony base | |||||
* class that had a constructor (with default arguments). To lower the risk of | |||||
* a breaking change (PHP won't allow parent constructor calls if there is none), | |||||
* this empty constructor's only purpose is to hopefully not break existing sub- | |||||
* classes of this class. | |||||
* | |||||
* @since 18.0.0 | |||||
*/ | |||||
public function __construct() { | |||||
} | |||||
} | } |
* @since 17.0.0 | * @since 17.0.0 | ||||
*/ | */ | ||||
public function __construct(ContentSecurityPolicyManager $policyManager) { | public function __construct(ContentSecurityPolicyManager $policyManager) { | ||||
parent::__construct(); | |||||
$this->policyManager = $policyManager; | $this->policyManager = $policyManager; | ||||
} | } | ||||
* @since 17.0.0 | * @since 17.0.0 | ||||
*/ | */ | ||||
public function __construct(FeaturePolicyManager $policyManager) { | public function __construct(FeaturePolicyManager $policyManager) { | ||||
parent::__construct(); | |||||
$this->policyManager = $policyManager; | $this->policyManager = $policyManager; | ||||
} | } | ||||
<?php | |||||
<?php declare(strict_types=1); | |||||
/** | /** | ||||
* @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> | * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> | ||||
use OCP\Authentication\TwoFactorAuth\IProvider; | use OCP\Authentication\TwoFactorAuth\IProvider; | ||||
use OCP\Authentication\TwoFactorAuth\IRegistry; | use OCP\Authentication\TwoFactorAuth\IRegistry; | ||||
use OCP\Authentication\TwoFactorAuth\RegistryEvent; | use OCP\Authentication\TwoFactorAuth\RegistryEvent; | ||||
use OCP\EventDispatcher\IEventDispatcher; | |||||
use OCP\IUser; | use OCP\IUser; | ||||
use PHPUnit_Framework_MockObject_MockObject; | |||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface; | |||||
use PHPUnit\Framework\MockObject\MockObject; | |||||
use Test\TestCase; | use Test\TestCase; | ||||
class RegistryTest extends TestCase { | class RegistryTest extends TestCase { | ||||
/** @var ProviderUserAssignmentDao|PHPUnit_Framework_MockObject_MockObject */ | |||||
/** @var ProviderUserAssignmentDao|MockObject */ | |||||
private $dao; | private $dao; | ||||
/** @var IEventDispatcher|MockObject */ | |||||
private $dispatcher; | |||||
/** @var Registry */ | /** @var Registry */ | ||||
private $registry; | private $registry; | ||||
/** @var EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject */ | |||||
private $dispatcher; | |||||
protected function setUp() { | protected function setUp() { | ||||
parent::setUp(); | parent::setUp(); | ||||
$this->dao = $this->createMock(ProviderUserAssignmentDao::class); | $this->dao = $this->createMock(ProviderUserAssignmentDao::class); | ||||
$this->dispatcher = $this->createMock(EventDispatcherInterface::class); | |||||
$this->dispatcher = $this->createMock(IEventDispatcher::class); | |||||
$this->registry = new Registry($this->dao, $this->dispatcher); | $this->registry = new Registry($this->dao, $this->dispatcher); | ||||
} | } |