@@ -35,7 +35,7 @@ public function testReturnsPluginLocalPathsWhenCloudIsDisabled(): void
3535
3636 public function testReturnsSharedPathsWhenCloudIsEnabledAndDistributedCachePathExists (): void
3737 {
38- $ resolver = new PathResolver ( ' /plugins/OpenApiDocs ' , true , $ this ->buildContainerStub (true , '/cache/distributed ' ) );
38+ $ resolver = $ this ->buildPathResolverWithSharedPathValidationResult (true , '/cache/distributed ' , true );
3939
4040 $ this ->assertSame ('/cache/distributed/OpenApiDocs/specs/ ' , $ resolver ->getSpecDirectory ());
4141 $ this ->assertSame ('/cache/distributed/OpenApiDocs/annotations/ ' , $ resolver ->getAnnotationsDirectory ());
@@ -62,7 +62,7 @@ public function testFallsBackToPluginLocalPathsWhenCloudCachePathIsEmpty(): void
6262
6363 public function testBuildsFilePathsUsingExpectedNamingConventions (): void
6464 {
65- $ resolver = new PathResolver ( ' /plugins/OpenApiDocs ' , true , $ this ->buildContainerStub (true , '/cache/distributed/ ' ) );
65+ $ resolver = $ this ->buildPathResolverWithSharedPathValidationResult (true , '/cache/distributed/ ' , true );
6666
6767 $ this ->assertSame (
6868 '/cache/distributed/OpenApiDocs/specs/CustomAlerts_openapi_spec_v2.0.0.yaml ' ,
@@ -101,4 +101,21 @@ private function buildContainerStub(bool $hasDistributedCachePath, string $distr
101101
102102 return $ container ;
103103 }
104+
105+ private function buildPathResolverWithSharedPathValidationResult (
106+ bool $ hasDistributedCachePath ,
107+ string $ distributedCachePath ,
108+ bool $ isUsableSharedBasePath
109+ ): PathResolver {
110+ $ resolver = $ this ->getMockBuilder (PathResolver::class)
111+ ->setConstructorArgs (['/plugins/OpenApiDocs ' , true , $ this ->buildContainerStub ($ hasDistributedCachePath , $ distributedCachePath )])
112+ ->onlyMethods (['isUsableSharedBasePath ' ])
113+ ->getMock ();
114+
115+ $ resolver ->method ('isUsableSharedBasePath ' )
116+ ->with (trim ($ distributedCachePath ))
117+ ->willReturn ($ isUsableSharedBasePath );
118+
119+ return $ resolver ;
120+ }
104121}
0 commit comments