From: Derick Alangi Date: Sun, 14 Jul 2019 22:16:07 +0000 (+0100) Subject: resourceloader: Add unit tests for ResourceLoaderFilePath class methods X-Git-Tag: 1.34.0-rc.0~994^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=a53e5171cf4b2252bf1e3c8f73eec18b39138343;p=lhc%2Fweb%2Fwiklou.git resourceloader: Add unit tests for ResourceLoaderFilePath class methods ~ testConstructor() - unit test for the constructor method. ~ testGetLocalPath() - unit test for the getLocalPath() method. ~ testGetRemotePath() - unit test for the getRemotePath() method. ~ testGetPath() - unit test for the getPath() method. Change-Id: I0610938dd864931da7a7e1150ddb4d86ab9a2c5e --- diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderFilePathTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderFilePathTest.php new file mode 100644 index 0000000000..292340bcf2 --- /dev/null +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderFilePathTest.php @@ -0,0 +1,53 @@ +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() + ); + } +}