Merge "resourceloader: Add unit tests for ResourceLoaderFilePath class methods"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 15 Jul 2019 21:58:57 +0000 (21:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 15 Jul 2019 21:58:57 +0000 (21:58 +0000)
tests/phpunit/includes/resourceloader/ResourceLoaderFilePathTest.php [new file with mode: 0644]

diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderFilePathTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderFilePathTest.php
new file mode 100644 (file)
index 0000000..292340b
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+
+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'
+               );
+
+               $this->assertSame(
+                       'remoteBasePath/dummy/path', $resourceLoaderFilePath->getRemotePath()
+               );
+       }
+
+       /**
+        * @covers ResourceLoaderFilePath::getPath
+        */
+       public function testGetPath() {
+               $resourceLoaderFilePath = new ResourceLoaderFilePath(
+                       'dummy/path', 'localBasePath', 'remoteBasePath'
+               );
+
+               $this->assertSame(
+                       'dummy/path', $resourceLoaderFilePath->getPath()
+               );
+       }
+}