-
Notifications
You must be signed in to change notification settings - Fork 50
Make it possible to create public httplug clients #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
use Http\HttplugBundle\DependencyInjection\HttplugExtension; | ||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
|
||
/** | ||
* @author David Buchmann <[email protected]> | ||
|
@@ -267,4 +268,145 @@ private function verifyProfilingDisabled() | |
); | ||
} | ||
} | ||
|
||
public function testClientShouldHaveDefaultVisibility() | ||
{ | ||
$this->load([ | ||
'clients' => [ | ||
'acme' => [], | ||
], | ||
]); | ||
|
||
$this->assertContainerBuilderHasService('httplug.client.acme'); | ||
|
||
if (version_compare(Kernel::VERSION, '3.4', '>=')) { | ||
// Symfony made services private by default starting from 3.4 | ||
$this->assertTrue($this->container->getDefinition('httplug.client.acme')->isPublic()); | ||
$this->assertTrue($this->container->getDefinition('httplug.client.acme')->isPrivate()); | ||
} else { | ||
// Legacy Symfony | ||
$this->assertTrue($this->container->getDefinition('httplug.client.acme')->isPublic()); | ||
} | ||
} | ||
|
||
public function testFlexibleClientShouldBePrivateByDefault() | ||
{ | ||
$this->load([ | ||
'clients' => [ | ||
'acme' => [ | ||
'flexible_client' => true, | ||
], | ||
], | ||
]); | ||
|
||
$this->assertContainerBuilderHasService('httplug.client.acme'); | ||
$this->assertFalse($this->container->getDefinition('httplug.client.acme.flexible')->isPublic()); | ||
} | ||
|
||
public function testHttpMethodsClientShouldBePrivateByDefault() | ||
{ | ||
$this->load([ | ||
'clients' => [ | ||
'acme' => [ | ||
'http_methods_client' => true, | ||
], | ||
], | ||
]); | ||
|
||
$this->assertContainerBuilderHasService('httplug.client.acme'); | ||
$this->assertFalse($this->container->getDefinition('httplug.client.acme.http_methods')->isPublic()); | ||
} | ||
|
||
public function testBatchClientShouldBePrivateByDefault() | ||
{ | ||
$this->load([ | ||
'clients' => [ | ||
'acme' => [ | ||
'batch_client' => true, | ||
], | ||
], | ||
]); | ||
|
||
$this->assertContainerBuilderHasService('httplug.client.acme'); | ||
$this->assertFalse($this->container->getDefinition('httplug.client.acme.batch_client')->isPublic()); | ||
} | ||
|
||
public function testClientCanBePublic() | ||
{ | ||
$this->load([ | ||
'clients' => [ | ||
'acme' => [ | ||
'public' => true, | ||
], | ||
], | ||
]); | ||
|
||
$this->assertContainerBuilderHasService('httplug.client.acme'); | ||
$this->assertTrue($this->container->getDefinition('httplug.client.acme')->isPublic()); | ||
|
||
if (version_compare(Kernel::VERSION, '3.4', '>=')) { | ||
// Symfony made services private by default starting from 3.4 | ||
$this->assertFalse($this->container->getDefinition('httplug.client.acme')->isPrivate()); | ||
} | ||
} | ||
|
||
public function testFlexibleClientCanBePublic() | ||
{ | ||
$this->load([ | ||
'clients' => [ | ||
'acme' => [ | ||
'public' => true, | ||
'flexible_client' => true, | ||
], | ||
], | ||
]); | ||
|
||
$this->assertContainerBuilderHasService('httplug.client.acme'); | ||
$this->assertTrue($this->container->getDefinition('httplug.client.acme.flexible')->isPublic()); | ||
|
||
if (version_compare(Kernel::VERSION, '3.4', '>=')) { | ||
// Symfony made services private by default starting from 3.4 | ||
$this->assertFalse($this->container->getDefinition('httplug.client.acme.flexible')->isPrivate()); | ||
} | ||
} | ||
|
||
public function testHttpMethodsClientCanBePublic() | ||
{ | ||
$this->load([ | ||
'clients' => [ | ||
'acme' => [ | ||
'public' => true, | ||
'http_methods_client' => true, | ||
], | ||
], | ||
]); | ||
|
||
$this->assertContainerBuilderHasService('httplug.client.acme'); | ||
$this->assertTrue($this->container->getDefinition('httplug.client.acme.http_methods')->isPublic()); | ||
|
||
if (version_compare(Kernel::VERSION, '3.4', '>=')) { | ||
// Symfony made services private by default starting from 3.4 | ||
$this->assertFalse($this->container->getDefinition('httplug.client.acme.http_methods')->isPrivate()); | ||
} | ||
} | ||
|
||
public function testBatchClientCanBePublic() | ||
{ | ||
$this->load([ | ||
'clients' => [ | ||
'acme' => [ | ||
'public' => true, | ||
'batch_client' => true, | ||
], | ||
], | ||
]); | ||
|
||
$this->assertContainerBuilderHasService('httplug.client.acme'); | ||
$this->assertTrue($this->container->getDefinition('httplug.client.acme.batch_client')->isPublic()); | ||
|
||
if (version_compare(Kernel::VERSION, '3.4', '>=')) { | ||
// Symfony made services private by default starting from 3.4 | ||
$this->assertFalse($this->container->getDefinition('httplug.client.acme.batch_client')->isPrivate()); | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.