Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TAO-8697 - Replace Calls of singleton method by ServiceManager calls #108

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/default/Groups.conf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
/**
* Default config header created during install
*/

return new oat\taoGroups\models\GroupsService();
2 changes: 1 addition & 1 deletion manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'label' => 'Groups core extension',
'description' => 'TAO Groups extension',
'license' => 'GPL-2.0',
'version' => '6.1.1',
'version' => '6.1.2',
'author' => 'Open Assessment Technologies, CRP Henri Tudor',
'requires' => array(
'taoTestTaker' => '>=4.0.0',
Expand Down
2 changes: 2 additions & 0 deletions models/GroupsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
class GroupsService extends OntologyClassService
{
const SERVICE_ID = 'taoGroups/Groups';

const CLASS_URI = 'http://www.tao.lu/Ontologies/TAOGroup.rdf#Group';

const PROPERTY_MEMBERS_URI = 'http://www.tao.lu/Ontologies/TAOGroup.rdf#member';
Expand Down
7 changes: 7 additions & 0 deletions models/update/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use oat\tao\model\accessControl\func\AccessRule;
use oat\tao\model\user\TaoRoles;
use oat\taoGroups\controller\Api;

/**
* Service methods to manage the Groups business models using the RDF API.
*
Expand Down Expand Up @@ -78,5 +79,11 @@ public function update($initialVersion)
}

$this->skip('3.0.1','6.1.1');

if ($this->isVersion('6.1.1')) {
$groupsService = new GroupsService();
$this->getServiceManager()->register(GroupsService::SERVICE_ID, $groupsService);
$this->setVersion('6.1.2');
}
}
}
14 changes: 11 additions & 3 deletions test/integration/GroupsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use \core_kernel_classes_Class;
use \core_kernel_classes_Property;
use oat\tao\test\TaoPhpUnitTestRunner;
use oat\oatbox\service\ServiceManager;



Expand All @@ -55,8 +56,15 @@ class GroupsTest extends TaoPhpUnitTestRunner {
public function setUp()
{
TaoPhpUnitTestRunner::initTest();
$this->subjectsService = new TestTakerService();
$this->groupsService = new GroupsService();

$subjectsService = new TestTakerService();
$groupsService = new GroupsService();
$smMock = $this->getServiceLocatorMock([
'TestTakerService' => $subjectsService,
GroupsService::SERVICE_ID => $groupsService
]);
$this->subjectsService = $smMock->get('TestTakerService');
$this->groupsService = $smMock->get(GroupsService::SERVICE_ID);
}

/**
Expand Down Expand Up @@ -204,4 +212,4 @@ public function testGetGroups()
$subject->delete();
}

}
}