diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-10-18 09:31:31 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-10-18 09:31:31 +0200 |
commit | 80f7dc77d430774192b929d780f96260066df2ee (patch) | |
tree | 102eaae7fc9ec567f2af76e96da3de2d1e83afcf /vendor/ruflin/elastica/test/lib/Elastica/Test/UtilTest.php | |
parent | cccd7bb4d819334c07e0dadaf16cbfdef31880e1 (diff) |
Update to MediaWiki 1.25.3
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/UtilTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/UtilTest.php | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/UtilTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/UtilTest.php deleted file mode 100644 index 09d4b5b1..00000000 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/UtilTest.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php - -namespace Elastica\Test; - -use Elastica\Util; -use Elastica\Request; -use Elastica\Connection; -use Elastica\Test\Base as BaseTest; - -class UtilTest extends BaseTest -{ - /** - * @dataProvider getEscapeTermPairs - */ - public function testEscapeTerm($unescaped, $escaped) - { - $this->assertEquals($escaped, Util::escapeTerm($unescaped)); - } - - public function getEscapeTermPairs() - { - return array( - array('', ''), - array('pragmatic banana', 'pragmatic banana'), - array('oh yeah!', 'oh yeah\\!'), - // Seperate test below because phpunit seems to have some problems - //array('\\+-&&||!(){}[]^"~*?:', '\\\\\\+\\-\\&&\\||\\!\\(\\)\\{\\}\\[\\]\\^\\"\\~\\*\\?\\:'), - array('some signs, can stay.', 'some signs, can stay.') - ); - } - - public function testEscapeTermSpecialCharacters() - { - $before = '\\+-&&||!(){}[]^"~*?:/'; - $after = '\\\\\\+\\-\\&&\\||\\!\\(\\)\\{\\}\\[\\]\\^\\"\\~\\*\\?\\:\\\\/'; - - $this->assertEquals(Util::escapeTerm($before), $after); - } - - public function testToCamelCase() - { - $string = 'hello_world'; - $this->assertEquals('HelloWorld', Util::toCamelCase($string)); - - $string = 'how_are_you_today'; - $this->assertEquals('HowAreYouToday', Util::toCamelCase($string)); - } - - public function testToSnakeCase() - { - $string = 'HelloWorld'; - $this->assertEquals('hello_world', Util::toSnakeCase($string)); - - $string = 'HowAreYouToday'; - $this->assertEquals('how_are_you_today', Util::toSnakeCase($string)); - } - - public function testConvertRequestToCurlCommand() - { - $path = 'test'; - $method = Request::POST; - $query = array('no' => 'params'); - $data = array('key' => 'value'); - - $connection = new Connection(); - $connection->setHost('localhost'); - $connection->setPort('9200'); - - $request = new Request($path, $method, $data, $query, $connection); - - $curlCommand = Util::convertRequestToCurlCommand($request); - - $expected = 'curl -XPOST \'http://localhost:9200/test?no=params\' -d \'{"key":"value"}\''; - $this->assertEquals($expected, $curlCommand); - - } -} |