-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[PhpUnitBridge] Mock DNS functions #18181
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
Conversation
nicolas-grekas
commented
Mar 15, 2016
| Q | A |
|---|---|
| Branch | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #16819 |
| License | MIT |
| Doc PR | - |
715a003 to
5abd11d
Compare
|
Thanks for this, @nicolas-grekas ! |
| { | ||
| return isset(self::$resolutions[$type][$host]) | ||
| ? self::$resolutions[$type][$host] | ||
| : \checkdnsrr($host, $type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be on one line :)
5abd11d to
ddefaa3
Compare
9f5b856 to
d21746c
Compare
|
This PR now has mocks for all DNS functions, and unit tests. |
d21746c to
391d2c8
Compare
composer.json
Outdated
| "Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/", | ||
| "Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/", | ||
| "Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/", | ||
| "Symfony\\Bridge\\": "src/Symfony/Bridge/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the reason we didn't have this before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
0a79ba1 to
7a8b925
Compare
|
|
||
| use Symfony\Bridge\PhpUnit\DnsMock; | ||
|
|
||
| require_once __DIR__.'/../DnsMock.php'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is temporary until our phpunit wrapper is updated (PR coming on 2.3 after merge)
84455f4 to
1a8bb65
Compare
| private $isSkipped = array(); | ||
|
|
||
| public function __construct(array $extraClockMockedNamespaces = array()) | ||
| public function __construct(array $extraClockMockedNamespaces = array(), array $extraDnsMockedNamespaces = array()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does not scale well. I think we need to think about another way to inject those mocked configs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
98e58fa to
4619210
Compare
| private $isSkipped = array(); | ||
|
|
||
| public function __construct(array $extraClockMockedNamespaces = array()) | ||
| public function __construct(array $mockedNamespaces = array()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should now document which keys (groups) are supported by the listener.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documented, ok for you ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
4619210 to
0b31285
Compare
|
Thank you @nicolas-grekas. |
This PR was merged into the 3.1-dev branch. Discussion ---------- [PhpUnitBridge] Mock DNS functions | Q | A | ------------- | --- | Branch | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #16819 | License | MIT | Doc PR | - Commits ------- 0b31285 [PhpUnitBridge] Mock DNS functions
| } else { | ||
| self::$globallyEnabled = true; | ||
| if ($warn) { | ||
| echo "Clock-mocked namespaces for SymfonyTestsListener need to be nested in a \"time-sensitive\" key. This will be enforced in Symfony 4.0.\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
writing this to stderr would be better than in stdout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but did not work when I tried so I resorted to stdout, which is where phpunit and this listener echo in other cases...
This PR was merged into the 3.2 branch. Discussion ---------- [PhpUnitBridge] add a changelog file | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18181 | License | MIT | Doc PR | Commits ------- e5455db [PhpUnitBridge] add a changelog file