-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add integration test to demonstrate #27 * fix #27 by updating the signature of Hooks::onChangeRevision
- Loading branch information
1 parent
ec4a8c3
commit 41a9609
Showing
3 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ composer.lock | |
composer.phar | ||
|
||
vendor/ | ||
extensions/ | ||
extensions/ | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace SMW\ApprovedRevs\Tests\Integration; | ||
|
||
use ApiTestCase; | ||
|
||
/** | ||
* @group SemanticApprovedRevs | ||
* @group API | ||
* @group Database | ||
* @group medium | ||
* | ||
* @covers \SMW\ApprovedRevs\Hooks | ||
*/ | ||
class ApproveRevisionTest extends ApiTestCase { | ||
|
||
public function testApprove() { | ||
// NOTE: this test is known not to work when using MySql | ||
// Seems like an SMW problem with temporary tables; the following would help: | ||
// \MediaWikiCliOptions::$additionalOptions['use-normal-tables'] = true | ||
|
||
// Re-register SMW hook handlers | ||
// TODO: find a way to have the test use the Wiki "as it is" without having to re-register manually | ||
\SemanticMediaWiki::onExtensionFunction(); | ||
\SMW\ApprovedRevs\Hooks::onExtensionFunction(); | ||
|
||
$page = $this->getExistingTestPage('ApproveRevisionApiTest'); | ||
$revId = $page->getRevisionRecord()->getId(); | ||
$tokens = $this->getTokenList($this->getTestSysop()); | ||
|
||
$result = $this->doApiRequest( [ | ||
'action' => 'approve', | ||
'revid' => $revId, | ||
'token' => $tokens['edittoken'] | ||
] ); | ||
|
||
$this->assertEquals("Revision was successfully approved.", $result[0]["approve"]["result"]); | ||
} | ||
} |