jenkins-bot has submitted this change and it was merged.
Change subject: Add test for EntityView::getHtmlForEditSection
......................................................................
Add test for EntityView::getHtmlForEditSection
Change-Id: I99f15738a90a02c9fe3431c7bbb38645c87b1460
---
M repo/tests/phpunit/includes/EntityViewTest.php
1 file changed, 42 insertions(+), 1 deletion(-)
Approvals:
Hoo man: Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/tests/phpunit/includes/EntityViewTest.php
b/repo/tests/phpunit/includes/EntityViewTest.php
index e0e35d9..434ee13 100644
--- a/repo/tests/phpunit/includes/EntityViewTest.php
+++ b/repo/tests/phpunit/includes/EntityViewTest.php
@@ -150,6 +150,47 @@
}
/**
+ * @dataProvider getHtmlForEditSectionProvider
+ */
+ public function testGetHtmlForEditSection( $expected, $url, $tag,
$action, $enabled, $langCode ) {
+ $entityView = $this->newEntityView( Item::ENTITY_TYPE );
+
+ $context = $entityView->getContext();
+ $context->setLanguage( $langCode );
+ $entityView->setContext( $context );
+
+ $editSectionHtml = $entityView->getHtmlForEditSection( $url,
$tag, $action, $enabled );
+ $matcher = array(
+ 'tag' => $tag,
+ 'class' => 'wb-editsection'
+ );
+
+ $this->assertTag( $matcher, $editSectionHtml, "$action action"
);
+ $this->assertRegExp( "/$expected/", $editSectionHtml, "$action
button label" );
+ }
+
+ public function getHtmlForEditSectionProvider() {
+ return array(
+ array(
+ wfMessage( 'wikibase-edit' )->inLanguage( 'es'
)->text(),
+ '',
+ 'div',
+ 'edit',
+ true,
+ 'es'
+ ),
+ array(
+ wfMessage( 'wikibase-add' )->inLanguage( 'de'
)->text(),
+ '',
+ 'span',
+ 'add',
+ true,
+ 'de'
+ )
+ );
+ }
+
+ /**
* @return array
*/
public function getHtmlForClaimsProvider() {
@@ -372,7 +413,7 @@
// test whether we get the right EntityView from an
EntityRevision
$view = EntityView::newForEntityType(
$entityRevision->getEntity()->getType(),
- $this->newSnakFormatterMock(),
+ $this->newSnakFormatterMock(),
$dataTypeLookup,
$entityInfoBuilder,
$entityTitleLookup
--
To view, visit https://gerrit.wikimedia.org/r/99557
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I99f15738a90a02c9fe3431c7bbb38645c87b1460
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits