File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55use Redmine \Api ;
66use Redmine \Exception \InvalidApiNameException ;
7+ use Redmine \Future ;
78
89/**
910 * Provide API instantiation to clients.
@@ -60,6 +61,11 @@ public function getApi(string $name): Api
6061 return $ this ->apiInstances [$ name ];
6162 }
6263
64+ public function enableFutureMode (): void
65+ {
66+ Future::enableForwardCompatibility ();
67+ }
68+
6369 private function isUploadCall (string $ path ): bool
6470 {
6571 $ path = strtolower ($ path );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Redmine \Tests \Unit \Client \NativeCurlClient ;
6+
7+ use PHPUnit \Framework \Attributes \CoversClass ;
8+ use PHPUnit \Framework \TestCase ;
9+ use Redmine \Client \NativeCurlClient ;
10+ use Redmine \Future ;
11+
12+ #[CoversClass(NativeCurlClient::class)]
13+ final class EnableFutureModeTest extends TestCase
14+ {
15+ public function testEnableFutureModeEnablesFutureMode (): void
16+ {
17+ Future::disableForwardCompatibility ();
18+
19+ $ client = new NativeCurlClient (
20+ '' ,
21+ '' ,
22+ );
23+ $ client ->enableFutureMode ();
24+
25+ self ::assertTrue (Future::isForwardCompatibilityEnabled ());
26+
27+ Future::disableForwardCompatibility ();
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Redmine \Tests \Unit \Client \Psr18Client ;
6+
7+ use PHPUnit \Framework \Attributes \CoversClass ;
8+ use PHPUnit \Framework \TestCase ;
9+ use Psr \Http \Client \ClientInterface ;
10+ use Psr \Http \Message \RequestFactoryInterface ;
11+ use Psr \Http \Message \StreamFactoryInterface ;
12+ use Redmine \Client \Psr18Client ;
13+ use Redmine \Future ;
14+
15+ #[CoversClass(Psr18Client::class)]
16+ final class EnableFutureModeTest extends TestCase
17+ {
18+ public function testEnableFutureModeEnablesFutureMode (): void
19+ {
20+ Future::disableForwardCompatibility ();
21+
22+ $ client = new Psr18Client (
23+ $ this ->createStub (ClientInterface::class),
24+ $ this ->createStub (RequestFactoryInterface::class),
25+ $ this ->createStub (StreamFactoryInterface::class),
26+ '' ,
27+ '' ,
28+ );
29+ $ client ->enableFutureMode ();
30+
31+ self ::assertTrue (Future::isForwardCompatibilityEnabled ());
32+
33+ Future::disableForwardCompatibility ();
34+ }
35+ }
Original file line number Diff line number Diff line change 44
55namespace Redmine \Tests \Unit ;
66
7+ use PHPUnit \Framework \Attributes \CoversClass ;
78use PHPUnit \Framework \TestCase ;
89use Redmine \Future ;
910
11+ #[CoversClass(Future::class)]
1012final class FutureTest extends TestCase
1113{
1214 public function testIsForwardCompatabilityEnabledReturnsFalseByDefault (): void
You can’t perform that action at this time.
0 commit comments