Mwjames has uploaded a new change for review.
https://gerrit.wikimedia.org/r/90389
Change subject: (#bug 55826) Force ApiBrowse unit test to fail
......................................................................
(#bug 55826) Force ApiBrowse unit test to fail
Bug 55826:
Change-Id: I8a368f7d27aa0aa71d8241df45faaa2daa6bf8c3
---
M includes/api/ApiBrowse.php
M tests/phpunit/includes/api/ApiBrowseSerializationRoundtripTest.php
2 files changed, 44 insertions(+), 22 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki
refs/changes/89/90389/1
diff --git a/includes/api/ApiBrowse.php b/includes/api/ApiBrowse.php
index b7525a2..4300878 100644
--- a/includes/api/ApiBrowse.php
+++ b/includes/api/ApiBrowse.php
@@ -113,12 +113,12 @@
*/
protected function addIndexTags( &$serialized ) {
- if ( isset( $serialized['data'] ) ) {
+ if ( isset( $serialized['data'] ) /* && is_array(
$serialized['data'] ) */ ) {
$this->getResult()->setIndexedTagName(
$serialized['data'], 'property' );
foreach ( $serialized['data'] as $key => $value ) {
- if ( isset( $serialized['data'][ $key
]['dataitem'] ) ) {
+ if ( isset( $serialized['data'][ $key
]['dataitem'] ) /* && is_array( $serialized['data'][ $key ]['dataitem'] ) */ ) {
$this->getResult()->setIndexedTagName(
$serialized['data'][ $key ]['dataitem'], 'value' );
}
}
diff --git a/tests/phpunit/includes/api/ApiBrowseSerializationRoundtripTest.php
b/tests/phpunit/includes/api/ApiBrowseSerializationRoundtripTest.php
index 55c6f06..ec4ceba 100644
--- a/tests/phpunit/includes/api/ApiBrowseSerializationRoundtripTest.php
+++ b/tests/phpunit/includes/api/ApiBrowseSerializationRoundtripTest.php
@@ -39,6 +39,24 @@
/**
* @dataProvider semanticDataProvider
+ * @see Bugzilla 55826
+ *
+ * @since 1.9
+ */
+ public function testExecuteOnRawModeAndMockStore( $setup ) {
+
+ $api = new ApiBrowse( $this->getApiMain( array( 'subject' =>
$setup['subject'] ) ), 'browse' );
+ $api->setStore( $setup['store'] );
+ $api->getMain()->getResult()->setRawMode();
+
+ $api->execute();
+
+ $this->assertStructuralIntegrity( $setup, $api->getResultData()
);
+
+ }
+
+ /**
+ * @dataProvider semanticDataProvider
*
* @since 1.9
*/
@@ -110,11 +128,12 @@
$provider[] = array(
array(
- 'subject' => 'Foo-0',
- 'store' => $mockStore,
- 'data' => $data,
- 'hasData' => false,
- 'hasSobj' => false
+ 'subject' => 'Foo-0',
+ 'store' => $mockStore,
+ 'data' => $data,
+ 'hasResult' => true,
+ 'hasData' => false,
+ 'hasSobj' => false
)
);
@@ -128,11 +147,12 @@
$provider[] = array(
array(
- 'subject' => 'Foo-1',
- 'store' => $mockStore,
- 'data' => $data,
- 'hasData' => true,
- 'hasSobj' => false
+ 'subject' => 'Foo-1',
+ 'store' => $mockStore,
+ 'data' => $data,
+ 'hasResult' => true,
+ 'hasData' => true,
+ 'hasSobj' => false
)
);
@@ -156,11 +176,12 @@
$provider[] = array(
array(
- 'subject' => 'Foo-2',
- 'store' => $mockStore,
- 'data' => $data,
- 'hasData' => true,
- 'hasSobj' => true
+ 'subject' => 'Foo-2',
+ 'store' => $mockStore,
+ 'data' => $data,
+ 'hasResult' => true,
+ 'hasData' => true,
+ 'hasSobj' => true
)
);
@@ -181,11 +202,12 @@
$provider[] = array(
array(
- 'subject' => 'Foo-3',
- 'store' => $mockStore,
- 'data' => $data,
- 'hasData' => true,
- 'hasSobj' => true
+ 'subject' => 'Foo-3',
+ 'store' => $mockStore,
+ 'data' => $data,
+ 'hasResult' => true,
+ 'hasData' => true,
+ 'hasSobj' => true
)
);
--
To view, visit https://gerrit.wikimedia.org/r/90389
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a368f7d27aa0aa71d8241df45faaa2daa6bf8c3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits