jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/346446 )

Change subject: Make tests pass by changing default port
......................................................................


Make tests pass by changing default port

etcd changed port numbers (<https://github.com/coreos/etcd/issues/948>)
to 2379 for clients.

Add a phpunit.xml.dist for actually running the tests, and get rid of
the unnecessary bootstrap.php.

Change-Id: Ib407cac6e5d49573544074efc464c4dbfb160cd9
---
A phpunit.xml.dist
M src/Client.php
D test/bootstrap.php
D test/phpunit.xml
M test/src/SettingsTest.php
5 files changed, 22 insertions(+), 22 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..df179d9
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,14 @@
+<phpunit colors="true"
+       beStrictAboutTestsThatDoNotTestAnything="true"
+       beStrictAboutOutputDuringTests="true">
+       <testsuites>
+               <testsuite name="etcd tests">
+                       <directory>./test</directory>
+               </testsuite>
+       </testsuites>
+       <filter>
+               <whitelist addUncoveredFilesFromWhitelist="true">
+                       <directory suffix=".php">./src</directory>
+               </whitelist>
+       </filter>
+</phpunit>
diff --git a/src/Client.php b/src/Client.php
index b2c854b..a4c5154 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -45,7 +45,7 @@
         * @param string $server
         * @param string $api_version
         */
-       public function __construct( $server = 'http://127.0.0.1:4001', 
$api_version = 'v2' ) {
+       public function __construct( $server = 'http://127.0.0.1:2379', 
$api_version = 'v2' ) {
                $this->setServer( $server );
                $this->setApiVersion( $api_version );
        }
diff --git a/test/bootstrap.php b/test/bootstrap.php
deleted file mode 100644
index d5280ac..0000000
--- a/test/bootstrap.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-date_default_timezone_set( 'GMT' );
-
-if ( is_file( dirname( __DIR__ ) . '/vendor/autoload.php' ) ) {
-       require dirname( __DIR__ ) . '/vendor/autoload.php';
-}
diff --git a/test/phpunit.xml b/test/phpunit.xml
deleted file mode 100644
index b22e980..0000000
--- a/test/phpunit.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<phpunit bootstrap="./bootstrap.php" backupGlobals="false" 
backupStaticAttributes="false" convertErrorsToExceptions="true" 
convertNoticesToExceptions="true" convertWarningsToExceptions="true" 
stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" 
stopOnSkipped="false" syntaxCheck="false" processIsolation="false" 
colors="true">
-    <testsuites>
-        <testsuite name="Etcd">
-            <directory>./src</directory>
-        </testsuite>
-    </testsuites>
-</phpunit>
diff --git a/test/src/SettingsTest.php b/test/src/SettingsTest.php
index 2970fad..407ae79 100644
--- a/test/src/SettingsTest.php
+++ b/test/src/SettingsTest.php
@@ -14,7 +14,7 @@
         */
        public function testDefaultServer() {
 
-               $this->assertEquals( 'http://127.0.0.1:4001', ( new Client() 
)->getServer() );
+               $this->assertEquals( 'http://127.0.0.1:2379', ( new Client() 
)->getServer() );
        }
 
        /**
@@ -23,8 +23,8 @@
        public function testSetServer() {
 
                $this->assertEquals(
-                       'http://localhost:4001',
-                               ( new Client() )->setServer( 
'http://localhost:4001/' )->getServer()
+                       'http://localhost:2379',
+                               ( new Client() )->setServer( 
'http://localhost:2379/' )->getServer()
                );
        }
 
@@ -45,8 +45,8 @@
                $is_https_property = $reflection->getProperty( 'is_https' );
                $is_https_property->setAccessible( true );
 
-               $this->assertFalse( $is_https_property->getValue( new Client( 
'http://127.0.0.1:4001' ) ) );
-               $this->assertTrue( $is_https_property->getValue( new Client( 
'https://127.0.0.1:4001' ) ) );
+               $this->assertFalse( $is_https_property->getValue( new Client( 
'http://127.0.0.1:2379' ) ) );
+               $this->assertTrue( $is_https_property->getValue( new Client( 
'https://127.0.0.1:2379' ) ) );
        }
 
        /**
@@ -151,11 +151,11 @@
         */
        public function testGetKeyUrl() {
 
-               $client = ( new Client( 'http://localhost:4001', 'v7' ) 
)->setSandboxPath( 'awesome/root' );
+               $client = ( new Client( 'http://localhost:2379', 'v7' ) 
)->setSandboxPath( 'awesome/root' );
                $this->assertInstanceOf( Client::class, $client );
 
                $this->assertEquals(
-                       
'http://localhost:4001/v7/keys/awesome/root/path/to/key',
+                       
'http://localhost:2379/v7/keys/awesome/root/path/to/key',
                        $client->getKeyUrl( 'path/to/key' )
                );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/346446
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib407cac6e5d49573544074efc464c4dbfb160cd9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/libs/etcd
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to