jenkins-bot has submitted this change and it was merged.
Change subject: Add tests for MemcachedBagOStuff::validateKeyEncoding
......................................................................
Add tests for MemcachedBagOStuff::validateKeyEncoding
If3e20c6 and the following patches introduced a breaking change and
cause a regression in Wikibase because we are using the version number
constant as part of a cache key prefix. Currently the Wikibase version
is set to "0.5 alpha".
Space characters were allowed before and encoded as "%20". This does
not happen any more.
Change-Id: Ia2fd4ed6738a10e02050bced947ef5d4e8b98980
---
M tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
1 file changed, 36 insertions(+), 1 deletion(-)
Approvals:
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
b/tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
index b0c9e4f..3e3bac3 100644
--- a/tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
+++ b/tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
@@ -12,7 +12,7 @@
}
/**
- * @covers MemcachedBagOStuff::makeKeyInternal
+ * @covers MemcachedBagOStuff::makeKey
*/
public function testKeyNormalization() {
$this->assertEquals(
@@ -67,4 +67,39 @@
$this->cache->makeKey( 'long_key_part_hashed',
str_repeat( 'y', 500 ) )
);
}
+
+ /**
+ * @dataProvider validKeyProvider
+ */
+ public function testValidateKeyEncoding( $key ) {
+ $this->assertSame( $key, $this->cache->validateKeyEncoding(
$key ) );
+ }
+
+ public function validKeyProvider() {
+ return array(
+ 'empty' => array( '' ),
+ 'digits' => array( '09' ),
+ 'letters' => array( 'AZaz' ),
+ 'ASCII special characters' => array(
'!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' ),
+ );
+ }
+
+ /**
+ * @dataProvider invalidKeyProvider
+ */
+ public function testValidateKeyEncodingThrowsException( $key ) {
+ $this->setExpectedException( 'Exception' );
+ $this->cache->validateKeyEncoding( $key );
+ }
+
+ public function invalidKeyProvider() {
+ return array(
+ array( "\x00" ),
+ array( ' ' ),
+ array( "\x1F" ),
+ array( "\x7F" ),
+ array( "\x80" ),
+ array( "\xFF" ),
+ );
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/249423
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia2fd4ed6738a10e02050bced947ef5d4e8b98980
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits