resourceloader: Complete test coverage for FilePath
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 19 Jul 2019 22:36:06 +0000 (23:36 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Fri, 19 Jul 2019 22:36:38 +0000 (23:36 +0100)
The 'getLocalBasePath' and 'getRemoteBasePath' methods were not
yet covered.

Change-Id: If2eacca3a908048ec62b357e14e4e2322363e296

tests/phpunit/includes/resourceloader/ResourceLoaderFilePathTest.php

index 292340b..1249ca5 100644 (file)
@@ -1,53 +1,23 @@
 <?php
 
+/**
+ * @covers ResourceLoaderFilePath
+ */
 class ResourceLoaderFilePathTest extends PHPUnit\Framework\TestCase {
-       /**
-        * @covers ResourceLoaderFilePath::__construct
-        */
-       public function testConstructor() {
-               $resourceLoaderFilePath = new ResourceLoaderFilePath(
-                       'dummy/path', 'localBasePath', 'remoteBasePath'
-               );
-
-               $this->assertInstanceOf( ResourceLoaderFilePath::class, $resourceLoaderFilePath );
-       }
-
-       /**
-        * @covers ResourceLoaderFilePath::getLocalPath
-        */
-       public function testGetLocalPath() {
-               $resourceLoaderFilePath = new ResourceLoaderFilePath(
-                       'dummy/path', 'localBasePath', 'remoteBasePath'
-               );
 
-               $this->assertSame(
-                       'localBasePath/dummy/path', $resourceLoaderFilePath->getLocalPath()
-               );
-       }
-
-       /**
-        * @covers ResourceLoaderFilePath::getRemotePath
-        */
-       public function testGetRemotePath() {
-               $resourceLoaderFilePath = new ResourceLoaderFilePath(
-                       'dummy/path', 'localBasePath', 'remoteBasePath'
-               );
+       public function testConstructor() {
+               $path = new ResourceLoaderFilePath( 'dummy/path', '/local', '/remote' );
 
-               $this->assertSame(
-                       'remoteBasePath/dummy/path', $resourceLoaderFilePath->getRemotePath()
-               );
+               $this->assertInstanceOf( ResourceLoaderFilePath::class, $path );
        }
 
-       /**
-        * @covers ResourceLoaderFilePath::getPath
-        */
-       public function testGetPath() {
-               $resourceLoaderFilePath = new ResourceLoaderFilePath(
-                       'dummy/path', 'localBasePath', 'remoteBasePath'
-               );
+       public function testGetters() {
+               $path = new ResourceLoaderFilePath( 'dummy/path', '/local', '/remote' );
 
-               $this->assertSame(
-                       'dummy/path', $resourceLoaderFilePath->getPath()
-               );
+               $this->assertSame( '/local/dummy/path', $path->getLocalPath() );
+               $this->assertSame( '/remote/dummy/path', $path->getRemotePath() );
+               $this->assertSame( '/local', $path->getLocalBasePath() );
+               $this->assertSame( '/remote', $path->getRemoteBasePath() );
+               $this->assertSame( 'dummy/path', $path->getPath() );
        }
 }