Skip to content
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

Edit tests in unit-testing.rst to fix error #5500

Closed
wants to merge 1 commit into from
Closed

Edit tests in unit-testing.rst to fix error #5500

wants to merge 1 commit into from

Conversation

TrueGit
Copy link
Contributor

@TrueGit TrueGit commented Jul 7, 2015

Q A
Doc fix? yes
New docs? no
Applies to 2.7
Fixed tickets NA?

In symfony-docs/create_framework/unit-testing.rst, in the
tutorial's "FrameworkTest" class, make following changes to
protected method named "getFrameworkForException" and to test
method named "testControllerResponse":
(i) add mock RequestContext, and
(ii) add to mock URLMatcherInterface the expectation that its
"getContext" method will be called and will return the mock
RequestContext.

Reason: Prior to these changes, running phpunit while following the
unit-testing.rst tutorial causes php error with message:
"Fatal error: Call to a member function fromRequest() on null in
[path/to/]example.com/src/Simplex/Framework.php on line 24"

The line 24 referred to in the foregoing error message is the first
line of the "handle" method of the tutorial's "Framework" class:
"$this->matcher->getContext()->fromRequest($request);"

In symfony-docs/create_framework/unit-testing.rst, in the
"FrameworkTest" class, make following changes to
protected method named "getFrameworkForException" and to test
method named "testControllerResponse":
    (i)  add mock RequestContext, and
    (ii) add to mock URLMatcherInterface the expectation that its
"getContext" method will be called and will return the mock
RequestContext.

Reason: Prior to these changes, running phpunit while following the
tutorial causes php error with message:
  "Fatal error: Call to a member function fromRequest() on null in
  [path/to/]example.com/src/Simplex/Framework.php on line 24"

The line 24 referred to in the foregoing error message is the first
line of the Framework class's handle method:
    "$this->matcher->getContext()->fromRequest($request);"
@wouterj
Copy link
Member

wouterj commented Dec 19, 2015

Thanks for submitting this fix! Unfortuantely, 2 days before you submitted this PR, someone already submitted a fix: #5488

As that fixed is now merged, I'm going to close this one. Thanks again! 🎄

@wouterj wouterj closed this Dec 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants