Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Enhance test environment

=> run make test to run all tests

- forward Erfurt submodule
  • Loading branch information...
commit 5a2a632e30bde17fc6a02c7439e59266e5929871 1 parent 32aa515
Philipp Frischmuth pfrischmuth authored
45 Makefile
View
@@ -68,10 +68,14 @@ help-cs:
@echo " > OPTIONS=<option> ............. Run code checking with specific CodeSniffer options"
help-test:
- @echo " test ....................... Execute unit and integration tests"
- @echo " test-unit .................. Run OntoWiki unit tests"
- @echo " test-integration ........... Run OntoWiki integration tests"
- @echo " test-extensions ............ Run tests for extensions"
+ @echo " test ......................... Execute unit, integration and extension tests"
+ @echo " test-unit .................... Run OntoWiki unit tests"
+ @echo " test-unit-cc ................. Same as above plus code coverage report"
+ @echo " test-integration-virtuoso .... Run OntoWiki integration tests with virtuoso"
+ @echo " test-integration-virtuoso-cc . Same as above plus code coverage report"
+ @echo " test-integration-mysql ....... Run OntoWiki integration tests with mysql"
+ @echo " test-integration-mysql-cc .... Same as above plus code coverage report"
+ @echo " test-extensions .............. Run tests for extensions"
# top level target
@@ -160,21 +164,42 @@ rdfauthor:
# test stuff
-test-unit:
+test-unit: directories
+ @cd application/tests && phpunit --bootstrap Bootstrap.php unit/
+
+test-unit-cc: directories
@cd application/tests/unit && phpunit
-test-integration:
- @cd application/tests/integration && phpunit
+test-integration-virtuoso: directories
+ @cd application/tests && EF_STORE_ADAPTER=virtuoso phpunit --bootstrap Bootstrap.php integration/
+
+test-integration-virtuoso-cc: directories
+ @cd application/tests/integration && EF_STORE_ADAPTER=virtuoso phpunit
+
+test-integration-mysql: directories
+ @cd application/tests && EF_STORE_ADAPTER=zenddb phpunit --bootstrap Bootstrap.php integration/
-test-extensions:
+test-integration-mysql-cc: directories
+ @cd application/tests/integration && EF_STORE_ADAPTER=zenddb phpunit
+
+test-extensions: directories
@phpunit --bootstrap application/tests/Bootstrap.php extensions
test:
- @make test-unit
+ make test-unit
@echo ""
@echo "-----------------------------------"
@echo ""
- @make test-integration
+ make test-integration-virtuoso
+ @echo ""
+ @echo "-----------------------------------"
+ @echo ""
+ make test-integration-mysql
+ @echo ""
+ @echo "-----------------------------------"
+ @echo ""
+ make test-extensions
+
install-test-environment:
sudo apt-get install php-pear
2  application/Bootstrap.php
View
@@ -94,6 +94,8 @@ public function _initExtensionManager()
// actionhelper
Zend_Controller_Action_HelperBroker::addPrefix('OntoWiki_Controller_ActionHelper_');
Zend_Controller_Action_HelperBroker::addHelper(new OntoWiki_Controller_ActionHelper_List());
+
+ return $extensionManager;
}
/**
106 application/classes/OntoWiki/Test/ControllerTestCase.php
View
@@ -0,0 +1,106 @@
+<?php
+/**
+ * Created by JetBrains PhpStorm.
+ * User: philipp
+ * Date: 08.09.12
+ * Time: 14:59
+ * To change this template use File | Settings | File Templates.
+ */
+class OntoWiki_Test_ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase
+{
+ /** @var Erfurt_Ac_Test|Erfurt_Ac_Default */
+ protected $_ac = null;
+
+ /** @var Erfurt_Store_Adapter_Interface */
+ protected $_storeAdapter = null;
+
+ /** @var string|null */
+ protected $_extensionName = null;
+
+ public function setUpIntegrationTest()
+ {
+ $this->bootstrap = new Zend_Application(
+ 'integration_testing',
+ ONTOWIKI_ROOT . 'application/config/application.ini'
+ );
+
+ try {
+ parent::setUp();
+ } catch (Exception $e) {
+ // if we can't connect to the database, we skip the test
+ $this->markTestSkipped($e->getMessage());
+ }
+
+ // additional checks for database....
+ $this->_markTestNeedsDatabase();
+ }
+
+ public function setUpUnitTest()
+ {
+ $this->bootstrap = new Zend_Application(
+ 'unit_testing',
+ ONTOWIKI_ROOT . 'application/config/application.ini'
+ );
+
+ parent::setUp();
+ }
+
+ public function setUpExtensionUnitTest()
+ {
+ $this->bootstrap = new Zend_Application(
+ 'extension_unit_testing',
+ ONTOWIKI_ROOT . 'application/config/application.ini'
+ );
+ parent::setUp();
+
+ if (null !== $this->_extensionName) {
+ $extensionManager = OntoWiki::getInstance()->extensionManager;
+
+ if (!$extensionManager->isExtensionActive($this->_extensionName)) {
+ Erfurt_Event_Dispatcher::reset();
+ $this->markTestSkipped('extension is not active');
+ }
+ }
+
+ $this->_ac = Erfurt_App::getInstance(false)->getAc();
+ $this->_storeAdapter = Erfurt_App::getInstance(false)->getStore()->getBackendAdapter();
+ }
+
+ private function _markTestNeedsDatabase()
+ {
+ $config = Erfurt_App::getInstance(false)->getConfig();
+
+ $dbName = null;
+ if ($config->store->backend === 'virtuoso') {
+ if (isset($config->store->virtuoso->dsn)) {
+ $dbName = $config->store->virtuoso->dsn;
+ }
+ } else if ($config->store->backend === 'zenddb') {
+ if (isset($config->store->zenddb->dbname)) {
+ $dbName = $config->store->zenddb->dbname;
+ }
+ }
+
+ if ((null === $dbName) || (substr($dbName, -5) !== '_TEST')) {
+ $this->markTestSkipped('Invalid test database for tests: ' . $dbName); // make sure a test db was selected!
+ }
+
+ try {
+ $store = Erfurt_App::getInstance(false)->getStore();
+ $store->checkSetup();
+ $this->_dbWasUsed = true;
+ } catch (Erfurt_Store_Exception $e) {
+ if ($e->getCode() === 20) {
+ // Setup successful
+ $this->_dbWasUsed = true;
+ } else {
+ $this->markTestSkipped();
+ }
+ } catch (Erfurt_Exception $e2) {
+ $this->markTestSkipped();
+ }
+
+ $this->assertTrue(Erfurt_App::getInstance()->getStore()->isModelAvailable($config->sysont->modelUri, false));
+ $this->assertTrue(Erfurt_App::getInstance()->getStore()->isModelAvailable($config->sysont->schemaUri, false));
+ }
+}
67 application/classes/OntoWiki/Test/ExtensionUnitTestBootstrap.php
View
@@ -0,0 +1,67 @@
+<?php
+require_once realpath(dirname(dirname(dirname(dirname(__FILE__))))). DIRECTORY_SEPARATOR . 'Bootstrap.php';
+
+/**
+ * This file is part of the {@link http://ontowiki.net OntoWiki} project.
+ *
+ * @copyright Copyright (c) 2012, {@link http://aksw.org AKSW}
+ * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
+ */
+
+/**
+ * OntoWiki bootstrap class.
+ *
+ * Provides on-demand loading of application resources.
+ *
+ * @category OntoWiki
+ * @package OntoWiki_Bootstrap
+ * @copyright Copyright (c) 2012, {@link http://aksw.org AKSW}
+ * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
+ * @author Philipp Frischmuth <pfrischmuth@googlemail.com>
+ */
+class OntoWiki_Test_ExtensionUnitTestBootstrap extends Bootstrap
+{
+ public function _initErfurt()
+ {
+ $erfurt = null;
+
+ // require Config
+ $this->bootstrap('Config');
+ $config = $this->getResource('Config');
+
+ // require OntoWiki
+ $this->bootstrap('OntoWiki');
+ $ontoWiki = $this->getResource('OntoWiki');
+
+ // require Logger, since Erfurt logger should write into OW logs dir
+ $this->bootstrap('Logger');
+
+ // Reset the Erfurt app for testability... needs to be refactored.
+ Erfurt_App::reset();
+
+ try {
+ $erfurt = Erfurt_App::getInstance(false)->start($config);
+ } catch (Erfurt_Exception $ee) {
+ throw new OntoWiki_Exception('Error loading Erfurt framework: ' . $ee->getMessage());
+ } catch (Exception $e) {
+ throw new OntoWiki_Exception('Unexpected error: ' . $e->getMessage());
+ }
+
+ $testAdapter = new Erfurt_Store_Adapter_Test();
+ $store = new Erfurt_Store(
+ array(
+ 'adapterInstance' => $testAdapter
+ ),
+ 'Test'
+ );
+ $erfurt->setStore($store);
+
+ $testAc = new Erfurt_Ac_Test();
+ Erfurt_App::getInstance()->setAc($testAc);
+
+ // make available
+ $ontoWiki->erfurt = $erfurt;
+
+ return $erfurt;
+ }
+}
67 application/classes/OntoWiki/Test/IntegrationTestBootstrap.php
View
@@ -0,0 +1,67 @@
+<?php
+require_once realpath(dirname(dirname(dirname(dirname(__FILE__))))). DIRECTORY_SEPARATOR . 'Bootstrap.php';
+
+/**
+ * This file is part of the {@link http://ontowiki.net OntoWiki} project.
+ *
+ * @copyright Copyright (c) 2012, {@link http://aksw.org AKSW}
+ * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
+ */
+
+/**
+ * OntoWiki bootstrap class.
+ *
+ * Provides on-demand loading of application resources.
+ *
+ * @category OntoWiki
+ * @package OntoWiki_Bootstrap
+ * @copyright Copyright (c) 2012, {@link http://aksw.org AKSW}
+ * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
+ * @author Philipp Frischmuth <pfrischmuth@googlemail.com>
+ */
+class OntoWiki_Test_IntegrationTestBootstrap extends Bootstrap
+{
+ /**
+ * Overwrite the config bootstrap method, such that the store backend can be set via an environment variable.
+ *
+ * @return void|Zend_Config_Ini
+ */
+ public function _initConfig()
+ {
+ $config = parent::_initConfig();
+
+ // Overwrite database settings from test config
+ // load user application configuration files
+ $tryDistConfig = false;
+ try {
+ $privateConfig = new Zend_Config_Ini(ONTOWIKI_ROOT . 'application/tests/config.ini', 'private', true);
+ $config->merge($privateConfig);
+ } catch (Zend_Config_Exception $e) {
+ $tryDistConfig = true;
+ }
+
+ if ($tryDistConfig === true) {
+ try {
+ $privateConfig = new Zend_Config_Ini(ONTOWIKI_ROOT . 'application/tests/config.ini.dist', 'private', true);
+ $config->merge($privateConfig);
+ } catch (Zend_Config_Exception $e) {
+ $message = 'Failed to find test config';
+ throw new OntoWiki_Exception($message);
+ }
+ }
+
+ // overwrite store adapter to use with environment variable if set
+ // this is useful, when we want to test with different stores without manually
+ // editing the config
+ if ($config instanceof Zend_Config) {
+ $storeAdapter = getenv('EF_STORE_ADAPTER');
+ if (($storeAdapter === 'virtuoso') || ($storeAdapter === 'zenddb')) {
+ $config->store->backend = $storeAdapter;
+ } else if ($storeAdapter !== false) {
+ throw new Exception('Invalid value of $EF_STORE_ADAPTER: ' . $storeAdapter);
+ }
+ }
+
+ return $config;
+ }
+}
4 application/tests/TestBootstrap.php → ...ation/classes/OntoWiki/Test/UnitTestBootstrap.php
View
@@ -1,5 +1,5 @@
<?php
-require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
+require_once realpath(dirname(dirname(dirname(dirname(__FILE__))))). DIRECTORY_SEPARATOR . 'Bootstrap.php';
/**
* This file is part of the {@link http://ontowiki.net OntoWiki} project.
@@ -19,7 +19,7 @@
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
* @author Philipp Frischmuth <pfrischmuth@googlemail.com>
*/
-class TestBootstrap extends Bootstrap
+class OntoWiki_Test_UnitTestBootstrap extends Bootstrap
{
public function _initExtensionManager()
{
14 application/config/application.ini
View
@@ -27,7 +27,15 @@ includePaths.classes = APPLICATION_PATH "classes"
autoloaderNamespaces.ontoWiki = "OntoWiki_"
autoloaderNamespaces.erfurt = "Erfurt_"
-[testing : default]
-bootstrap.path = APPLICATION_PATH "tests/TestBootstrap.php"
-bootstrap.class = "TestBootstrap"
+[unit_testing : default]
+bootstrap.path = APPLICATION_PATH "classes/OntoWiki/Test/UnitTestBootstrap.php"
+bootstrap.class = "OntoWiki_Test_UnitTestBootstrap"
+
+[integration_testing : default]
+bootstrap.path = APPLICATION_PATH "classes/OntoWiki/Test/IntegrationTestBootstrap.php"
+bootstrap.class = "OntoWiki_Test_IntegrationTestBootstrap"
+
+[extension_unit_testing : default]
+bootstrap.path = APPLICATION_PATH "classes/OntoWiki/Test/ExtensionUnitTestBootstrap.php"
+bootstrap.class = "OntoWiki_Test_ExtensionUnitTestBootstrap"
4 application/tests/config.ini.dist
View
@@ -7,8 +7,8 @@
store.backend = zenddb ; zenddb, virtuoso, multi
store.zenddb.dbname = erfurt_TEST ; needs to end with _TEST
-store.zenddb.username = ow
-store.zenddb.password = ow
+store.zenddb.username = php
+store.zenddb.password = php
store.zenddb.dbtype = mysql ; mysql
;store.zenddb.host = localhost ; default is localhost
4 application/tests/integration/OntoWiki/Extension/ManagerIntegrationTest.php
View
@@ -13,10 +13,10 @@ protected function setUp()
{
$this->_resourcesDirectory = realpath(dirname(__FILE__)) . '/_files/';
- $this->markTestNeedsTestConfig();
+ $this->markTestNeedsDatabase();
$this->_bootstrap = new Zend_Application(
- 'testing',
+ 'integration_testing',
ONTOWIKI_ROOT . 'application/config/application.ini'
);
24 ...n/tests/unit/controller/ServiceControllerTest.php → .../integration/controller/ServiceControllerTest.php
View
@@ -40,23 +40,13 @@
* @author Philipp Frischmuth <pfrischmuth@googlemail.com>
* @author Konrad Abicht <k.abicht@googlemail.com>
*/
-class ServiceControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
+class ServiceControllerTest extends OntoWiki_Test_ControllerTestCase
{
public function setUp()
{
- $this->bootstrap = new Zend_Application(
- 'testing',
- ONTOWIKI_ROOT . 'application/config/application.ini'
- );
-
- parent::setUp();
+ $this->setUpIntegrationTest();
}
-
- public function tearDown()
- {
- parent::tearDown();
- }
-
+
// ------------------------------------------------------------------------
// Auth Action
// ------------------------------------------------------------------------
@@ -212,7 +202,7 @@ public function sparqlNoParameter()
* @test
*/
public function sparqlNoAuthWithInvalidQuery()
- {
+ {
// Send invalid query
$this->request->setMethod('POST')
->setPost(
@@ -220,10 +210,12 @@ public function sparqlNoAuthWithInvalidQuery()
);
$this->dispatch('/service/sparql');
-
+
+ $code = $this->_response->getHttpResponseCode();
+
$this->assertController('service');
$this->assertAction('sparql');
- $this->assertResponseCode(400);
+ $this->assertResponseCode(400, "$code returned instead");
}
// ------------------------------------------------------------------------
18 application/tests/unit/controller/IndexControllerTest.php
View
@@ -39,25 +39,13 @@
* @author Norman Heino <norman.heino@gmail.com>
* @author Philipp Frischmuth <pfrischmuth@googlemail.com>
*/
-class IndexControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
+class IndexControllerTest extends OntoWiki_Test_ControllerTestCase
{
public function setUp()
{
- //error_reporting(E_ALL ^ E_WARNING);
-
- $this->bootstrap = new Zend_Application(
- 'testing',
- ONTOWIKI_ROOT . 'application/config/application.ini'
- );
-
- parent::setUp();
+ $this->setUpUnitTest();
}
-
- public function tearDown()
- {
- parent::tearDown();
- }
-
+
public function testNoControllerAndActionDefaultToNewsAction()
{
$this->dispatch('/');
15 application/tests/unit/controller/ResourceControllerTest.php
View
@@ -39,22 +39,11 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPLv2)
* @author Jonas Brekle <jonas.brekle@gmail.com>
*/
-class ResourceControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
+class ResourceControllerTest extends OntoWiki_Test_ControllerTestCase
{
public function setUp()
{
- $this->bootstrap = new Zend_Application(
- 'testing',
- ONTOWIKI_ROOT . 'application/config/application.ini'
- );
- Zend_Controller_Action_HelperBroker::addHelper(new OntoWiki_Controller_ActionHelper_List());
-
- parent::setUp();
- }
-
- public function tearDown()
- {
- parent::tearDown();
+ $this->setUpUnitTest();
}
public function testDummyTestUnlessNoWorkingActualTestExists()
75 extensions/datagathering/tests/DatagatheringControllerTest.php
View
@@ -1,27 +1,12 @@
<?php
-class DatagatheringControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
+class DatagatheringControllerTest extends OntoWiki_Test_ControllerTestCase
{
- protected $_testAc = null;
- protected $_testAdapter = null;
-
public function setUp()
{
- $this->bootstrap = new Zend_Application(
- 'default',
- ONTOWIKI_ROOT . 'application/config/application.ini'
- );
-
- parent::setUp();
+ $this->_extensionName = 'datagathering';
- $this->_testAc = new Erfurt_Ac_Test();
- Erfurt_App::getInstance()->setAc($this->_testAc);
-
- $this->_testAdapter = new Erfurt_Store_Adapter_Test();
- Erfurt_App::getInstance()->setStore(new Erfurt_Store(
- array('adapterInstance' => $this->_testAdapter),
- 'Test'
- ));
+ $this->setUpExtensionUnitTest();
}
public function testImportActionRequestTypeNotGetBadRequest()
@@ -58,9 +43,9 @@ public function testImportActionInvalidWrapperParamBadRequest()
public function testImportActionModelNotEditableForbidden()
{
- $this->_testAdapter->createModel('http://example.org/testModel1');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'edit', 'deny');
+ $this->_storeAdapter->createModel('http://example.org/testModel1');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'edit', 'deny');
$this->request->setQuery(array(
'uri' => 'http://example.org/testResource1',
@@ -76,9 +61,9 @@ public function testImportActionModelNotEditableForbidden()
public function testImportActionWrapperResultFalse()
{
- $this->_testAdapter->createModel('http://example.org/testModel1');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
+ $this->_storeAdapter->createModel('http://example.org/testModel1');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
$this->request->setQuery(array(
'uri' => 'http://example.org/testResource1',
@@ -102,9 +87,9 @@ public function testImportActionWrapperResultFalse()
public function testImportActionWrapperResultEmptyArray()
{
- $this->_testAdapter->createModel('http://example.org/testModel1');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
+ $this->_storeAdapter->createModel('http://example.org/testModel1');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
Erfurt_Wrapper_Test::$runResult = array();
@@ -130,9 +115,9 @@ public function testImportActionWrapperResultEmptyArray()
public function testImportActionWrapperResultArrayNoAdd()
{
- $this->_testAdapter->createModel('http://example.org/testModel1');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
+ $this->_storeAdapter->createModel('http://example.org/testModel1');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
Erfurt_Wrapper_Test::$runResult = array('status_codes' => array());
@@ -160,9 +145,9 @@ public function testImportActionWrapperResultArrayWithAddButNothingAdded()
{
Erfurt_App::getInstance()->getVersioning()->enableVersioning(false);
- $this->_testAdapter->createModel('http://example.org/testModel1');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
+ $this->_storeAdapter->createModel('http://example.org/testModel1');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
Erfurt_Wrapper_Test::$runResult = array(
'status_codes' => array(Erfurt_Wrapper::RESULT_HAS_ADD),
@@ -193,12 +178,12 @@ public function testImportActionWrapperResultArrayWithAdd()
{
Erfurt_App::getInstance()->getVersioning()->enableVersioning(false);
- $this->_testAdapter->createModel('http://example.org/testModel1');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
+ $this->_storeAdapter->createModel('http://example.org/testModel1');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
- $this->_testAdapter->addCountResult(0);
- $this->_testAdapter->addCountResult(2);
+ $this->_storeAdapter->addCountResult(0);
+ $this->_storeAdapter->addCountResult(2);
$add = array(
'http://example.org/testResource1' => array(
@@ -238,19 +223,19 @@ public function testImportActionWrapperResultArrayWithAdd()
$this->assertArrayHasKey('message', $result);
$this->assertNotEmpty($result['message']);
- $this->assertEquals($add, $this->_testAdapter->getStatementsForGraph('http://example.org/testModel1'));
+ $this->assertEquals($add, $this->_storeAdapter->getStatementsForGraph('http://example.org/testModel1'));
}
public function testImportActionWrapperResultArrayWithAddMatchingPreset()
{
Erfurt_App::getInstance()->getVersioning()->enableVersioning(false);
- $this->_testAdapter->createModel('http://example.org/testModel1');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
- $this->_testAc->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
+ $this->_storeAdapter->createModel('http://example.org/testModel1');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'view', 'grant');
+ $this->_ac->setUserModelRight('http://example.org/testModel1', 'edit', 'grant');
- $this->_testAdapter->addCountResult(0);
- $this->_testAdapter->addCountResult(2);
+ $this->_storeAdapter->addCountResult(0);
+ $this->_storeAdapter->addCountResult(2);
$add = array(
'http://dbpedia.org/resource/Leipzig' => array(
@@ -290,6 +275,6 @@ public function testImportActionWrapperResultArrayWithAddMatchingPreset()
$this->assertArrayHasKey('message', $result);
$this->assertNotEmpty($result['message']);
- $this->assertEquals(array(), $this->_testAdapter->getStatementsForGraph('http://example.org/testModel1'));
+ $this->assertEquals(array(), $this->_storeAdapter->getStatementsForGraph('http://example.org/testModel1'));
}
}
20 extensions/source/tests/SourceControllerTest.php
View
@@ -1,25 +1,25 @@
<?php
-class SourceControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
+class SourceControllerTest extends OntoWiki_Test_ControllerTestCase
{
public function setUp()
{
- $this->bootstrap = new Zend_Application(
- 'testing',
- ONTOWIKI_ROOT . 'application/config/application.ini'
- );
- parent::setUp();
+ $this->_extensionName = 'source';
+
+ $this->setUpExtensionUnitTest();
}
public function testDispatching()
{
- $this->dispatch('/source/edit');
- $this->request->setParam('m', 'http://localhost/OntoWiki/Config/');
+ $this->_storeAdapter->createModel('http://localhost/OntoWiki/Config/');
+ $this->_ac->setUserModelRight('http://localhost/OntoWiki/Config/', 'view', 'grant');
+ $this->_ac->setUserModelRight('http://localhost/OntoWiki/Config/', 'edit', 'grant');
- $r = $this->getResponse();
- // var_dump($r->getBody());
+ $this->request->setParam('m', 'http://localhost/OntoWiki/Config/');
+ $this->dispatch('/source/edit');
$this->assertController('source');
$this->assertAction('edit');
+ @$this->assertResponseCode(200);
}
}
2  libraries/Erfurt
@@ -1 +1 @@
-Subproject commit 199302dd9345257bc304d53c6b4a295c22cc41ac
+Subproject commit da0e6150d228a7872b65fb7ff4c5c5a08708aa63
Please sign in to comment.
Something went wrong with that request. Please try again.