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

Change subject: tests: Complete code coverage to 100%
......................................................................


tests: Complete code coverage to 100%

Add missing test case for invalid input to getRelativePath().
This is the same test case we use for joinPath() as well.

Also ignore coverage for default value of $start. This is already
covered by tests, but by mocking the start directory. There is no
need to cover the actual call to PHP's getcwd().

Change-Id: I40e62f587df4fb22745bb62c8cf31f3128d2d7d0
---
M src/RelPath.php
M tests/RelPathTest.php
2 files changed, 3 insertions(+), 0 deletions(-)

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



diff --git a/src/RelPath.php b/src/RelPath.php
index 7d61d1a..a150ddf 100644
--- a/src/RelPath.php
+++ b/src/RelPath.php
@@ -73,8 +73,10 @@
  */
 function getRelativePath( $path, $start = null ) {
        if ( $start === null ) {
+               // @codeCoverageIgnoreStart
                $start = getcwd();
        }
+       // @codeCoverageIgnoreEnd
 
        if ( substr( $path, 0, 1 ) !== '/' || substr( $start, 0, 1 ) !== '/' ) {
                return false;
diff --git a/tests/RelPathTest.php b/tests/RelPathTest.php
index 2deeb37..3ac15c6 100644
--- a/tests/RelPathTest.php
+++ b/tests/RelPathTest.php
@@ -55,6 +55,7 @@
                        array( '/', '/', '.' ),
                        array( '/a', '/a', '.' ),
                        array( '/a/b', '/a/b', '.' ),
+                       array( 'foo/bar', 'quux', false ),
                );
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I40e62f587df4fb22745bb62c8cf31f3128d2d7d0
Gerrit-PatchSet: 1
Gerrit-Project: RelPath
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to