fileManager = $this->getMockBuilder(FileManager::class)->disableOriginalConstructor()->getMock(); } public function testGetFunctions(): void { $assetsExtension = $this ->getMockBuilder(AssetsExtension::class) ->setConstructorArgs([$this->fileManager]) ->setMethodsExcept(['getFunctions']) ->getMock(); $functions = $assetsExtension->getFunctions(); $this->assertCount(2, $functions); $this->assertEquals('absPath', $functions[0]->getName()); $this->assertEquals('fileImagePath', $functions[1]->getName()); } public function testAbsPath(): void { $assetsExtension = $this ->getMockBuilder(AssetsExtension::class) ->setConstructorArgs([$this->fileManager]) ->setMethodsExcept(['absPath']) ->getMock(); $publicDir = PathUtils::getProjectDir().'/public'; $this->assertEquals( $publicDir.'/foo', $assetsExtension->absPath('foo') ); $this->assertEquals( $publicDir.'/foo/bar', $assetsExtension->absPath('foo/bar') ); $this->assertEquals( $publicDir.'/', $assetsExtension->absPath('') ); } }