Merge pull request #24380 from owncloud/move-activity-manager-to-namespace

Move activity manager to the namespace
This commit is contained in:
Roeland Douma 2016-05-03 07:40:04 +02:00
commit c87bd0432a
5 changed files with 24 additions and 21 deletions

View File

@ -33,7 +33,7 @@ use Test\TestCase;
*/
class ActivityTest extends TestCase {
/** @var \OC\ActivityManager */
/** @var \OCP\Activity\IManager */
private $activityManager;
/** @var \OCP\IRequest|\PHPUnit_Framework_MockObject_MockObject */
@ -70,7 +70,7 @@ class ActivityTest extends TestCase {
->disableOriginalConstructor()
->getMock();
$this->activityManager = new \OC\ActivityManager(
$this->activityManager = new \OC\Activity\Manager(
$this->request,
$this->session,
$this->config

View File

@ -20,10 +20,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC;
namespace OC\Activity;
use OC\Activity\Event;
use OCP\Activity\IConsumer;
use OCP\Activity\IEvent;
use OCP\Activity\IExtension;
@ -33,7 +32,7 @@ use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
class ActivityManager implements IManager {
class Manager implements IManager {
/** @var IRequest */
protected $request;

View File

@ -313,7 +313,7 @@ class Server extends ServerContainer implements IServerContainer {
);
});
$this->registerService('ActivityManager', function (Server $c) {
return new ActivityManager(
return new \OC\Activity\Manager(
$c->getRequest(),
$c->getUserSession(),
$c->getConfig()

View File

@ -8,18 +8,22 @@
*
*/
class Test_ActivityManager extends \Test\TestCase {
namespace Test\Activity;
/** @var \OC\ActivityManager */
use Test\TestCase;
class ManagerTest extends TestCase {
/** @var \OC\Activity\Manager */
private $activityManager;
/** @var \PHPUnit_Framework_MockObject_MockObject */
/** @var \OCP\IRequest|\PHPUnit_Framework_MockObject_MockObject */
protected $request;
/** @var \PHPUnit_Framework_MockObject_MockObject */
/** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */
protected $session;
/** @var \PHPUnit_Framework_MockObject_MockObject */
/** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */
protected $config;
protected function setUp() {
@ -35,7 +39,7 @@ class Test_ActivityManager extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
$this->activityManager = new \OC\ActivityManager(
$this->activityManager = new \OC\Activity\Manager(
$this->request,
$this->session,
$this->config
@ -71,7 +75,7 @@ class Test_ActivityManager extends \Test\TestCase {
*/
public function testGetConsumersInvalidConsumer() {
$this->activityManager->registerConsumer(function() {
return new StdClass();
return new \stdClass();
});
$this->invokePrivate($this->activityManager, 'getConsumers');
@ -88,7 +92,7 @@ class Test_ActivityManager extends \Test\TestCase {
*/
public function testGetExtensionsInvalidExtension() {
$this->activityManager->registerExtension(function() {
return new StdClass();
return new \stdClass();
});
$this->invokePrivate($this->activityManager, 'getExtensions');
@ -119,10 +123,10 @@ class Test_ActivityManager extends \Test\TestCase {
}
public function testTranslate() {
$result = $this->activityManager->translate('APP0', '', '', array(), false, false, 'en');
$result = $this->activityManager->translate('APP0', '', array(), false, false, 'en');
$this->assertEquals('Stupid translation', $result);
$result = $this->activityManager->translate('APP1', '', '', array(), false, false, 'en');
$result = $this->activityManager->translate('APP1', '', array(), false, false, 'en');
$this->assertFalse($result);
}
@ -259,7 +263,7 @@ class Test_ActivityManager extends \Test\TestCase {
}
/**
* @expectedException BadMethodCallException
* @expectedException \BadMethodCallException
* @expectedExceptionMessage App not set
* @expectedExceptionCode 10
*/
@ -269,7 +273,7 @@ class Test_ActivityManager extends \Test\TestCase {
}
/**
* @expectedException BadMethodCallException
* @expectedException \BadMethodCallException
* @expectedExceptionMessage Type not set
* @expectedExceptionCode 11
*/
@ -280,7 +284,7 @@ class Test_ActivityManager extends \Test\TestCase {
}
/**
* @expectedException BadMethodCallException
* @expectedException \BadMethodCallException
* @expectedExceptionMessage Affected user not set
* @expectedExceptionCode 12
*/
@ -292,7 +296,7 @@ class Test_ActivityManager extends \Test\TestCase {
}
/**
* @expectedException BadMethodCallException
* @expectedException \BadMethodCallException
* @expectedExceptionMessage Subject not set
* @expectedExceptionCode 13
*/

View File

@ -44,7 +44,7 @@ class Server extends \Test\TestCase {
public function dataTestQuery() {
return [
['ActivityManager', '\OC\ActivityManager'],
['ActivityManager', '\OC\Activity\Manager'],
['ActivityManager', '\OCP\Activity\IManager'],
['AllConfig', '\OC\AllConfig'],
['AllConfig', '\OCP\IConfig'],