Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
php-symfony-contracts
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Debian PHP Team
PEAR
php-symfony-contracts
Commits
828a0955
Commit
828a0955
authored
1 year ago
by
David Prévot
Browse files
Options
Downloads
Plain Diff
New upstream version 3.4.1
parents
2e9e8b09
db06a3f3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Service/Test/ServiceLocatorTestCase.php
+10
-6
10 additions, 6 deletions
Service/Test/ServiceLocatorTestCase.php
Service/composer.json
+1
-1
1 addition, 1 deletion
Service/composer.json
Translation/Test/TranslatorTest.php
+2
-1
2 additions, 1 deletion
Translation/Test/TranslatorTest.php
with
13 additions
and
8 deletions
Service/Test/ServiceLocatorTestCase.php
+
10
−
6
View file @
828a0955
...
@@ -12,7 +12,9 @@
...
@@ -12,7 +12,9 @@
namespace
Symfony\Contracts\Service\Test
;
namespace
Symfony\Contracts\Service\Test
;
use
PHPUnit\Framework\TestCase
;
use
PHPUnit\Framework\TestCase
;
use
Psr\Container\ContainerExceptionInterface
;
use
Psr\Container\ContainerInterface
;
use
Psr\Container\ContainerInterface
;
use
Psr\Container\NotFoundExceptionInterface
;
use
Symfony\Contracts\Service\ServiceLocatorTrait
;
use
Symfony\Contracts\Service\ServiceLocatorTrait
;
abstract
class
ServiceLocatorTestCase
extends
TestCase
abstract
class
ServiceLocatorTestCase
extends
TestCase
...
@@ -66,27 +68,29 @@ abstract class ServiceLocatorTestCase extends TestCase
...
@@ -66,27 +68,29 @@ abstract class ServiceLocatorTestCase extends TestCase
public
function
testThrowsOnUndefinedInternalService
()
public
function
testThrowsOnUndefinedInternalService
()
{
{
if
(
!
$this
->
getExpectedException
())
{
$this
->
expectException
(
\Psr\Container\NotFoundExceptionInterface
::
class
);
$this
->
expectExceptionMessage
(
'The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.'
);
}
$locator
=
$this
->
getServiceLocator
([
$locator
=
$this
->
getServiceLocator
([
'foo'
=>
function
()
use
(
&
$locator
)
{
return
$locator
->
get
(
'bar'
);
},
'foo'
=>
function
()
use
(
&
$locator
)
{
return
$locator
->
get
(
'bar'
);
},
]);
]);
if
(
!
$this
->
getExpectedException
())
{
$this
->
expectException
(
NotFoundExceptionInterface
::
class
);
$this
->
expectExceptionMessage
(
'The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.'
);
}
$locator
->
get
(
'foo'
);
$locator
->
get
(
'foo'
);
}
}
public
function
testThrowsOnCircularReference
()
public
function
testThrowsOnCircularReference
()
{
{
$this
->
expectException
(
\Psr\Container\ContainerExceptionInterface
::
class
);
$this
->
expectExceptionMessage
(
'Circular reference detected for service "bar", path: "bar -> baz -> bar".'
);
$locator
=
$this
->
getServiceLocator
([
$locator
=
$this
->
getServiceLocator
([
'foo'
=>
function
()
use
(
&
$locator
)
{
return
$locator
->
get
(
'bar'
);
},
'foo'
=>
function
()
use
(
&
$locator
)
{
return
$locator
->
get
(
'bar'
);
},
'bar'
=>
function
()
use
(
&
$locator
)
{
return
$locator
->
get
(
'baz'
);
},
'bar'
=>
function
()
use
(
&
$locator
)
{
return
$locator
->
get
(
'baz'
);
},
'baz'
=>
function
()
use
(
&
$locator
)
{
return
$locator
->
get
(
'bar'
);
},
'baz'
=>
function
()
use
(
&
$locator
)
{
return
$locator
->
get
(
'bar'
);
},
]);
]);
$this
->
expectException
(
ContainerExceptionInterface
::
class
);
$this
->
expectExceptionMessage
(
'Circular reference detected for service "bar", path: "bar -> baz -> bar".'
);
$locator
->
get
(
'foo'
);
$locator
->
get
(
'foo'
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Service/composer.json
+
1
−
1
View file @
828a0955
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
],
],
"require"
:
{
"require"
:
{
"php"
:
">=8.1"
,
"php"
:
">=8.1"
,
"psr/container"
:
"^2.0"
"psr/container"
:
"^
1.1|^
2.0"
},
},
"conflict"
:
{
"conflict"
:
{
"ext-psr"
:
"<1.1|>=2"
"ext-psr"
:
"<1.1|>=2"
...
...
This diff is collapsed.
Click to expand it.
Translation/Test/TranslatorTest.php
+
2
−
1
View file @
828a0955
...
@@ -183,9 +183,10 @@ class TranslatorTest extends TestCase
...
@@ -183,9 +183,10 @@ class TranslatorTest extends TestCase
*/
*/
public
function
testThrowExceptionIfMatchingMessageCannotBeFound
(
$id
,
$number
)
public
function
testThrowExceptionIfMatchingMessageCannotBeFound
(
$id
,
$number
)
{
{
$this
->
expectException
(
\InvalidArgumentException
::
class
);
$translator
=
$this
->
getTranslator
();
$translator
=
$this
->
getTranslator
();
$this
->
expectException
(
\InvalidArgumentException
::
class
);
$translator
->
trans
(
$id
,
[
'%count%'
=>
$number
]);
$translator
->
trans
(
$id
,
[
'%count%'
=>
$number
]);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment