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

Problem with exception masking and generation for not found class #269

Closed
l3l0 opened this issue Jan 16, 2014 · 5 comments
Closed

Problem with exception masking and generation for not found class #269

l3l0 opened this issue Jan 16, 2014 · 5 comments

Comments

@l3l0
Copy link
Contributor

l3l0 commented Jan 16, 2014

Hello,

We (together with @omenrpg and @skowi) found some issue in phpspec example runner.

When we have stub like $user->changePassword('123')->shouldBeCalled(); phpspec masks all exception throwed by us (end users) or even by phpspec exceptions itself and instead show to us expectation fail (and mask our exception) - this even block phpspec from generation of not found class. This is really painful and confusing

I created some simple project to show what we are doing: https://github.com/l3l0/phpspec-exception-mask-issue

Expected results of call php bin/phpspec run:

Actual results of call php bin/phpspec run:

After some investigation we found that this was added in commit: 0780076 by $this->runMaintainersTeardown($maintainers, $example, $context, $matchers, $collaborators); stuff.. so all expectations are checked before exception is throw so if some expectation fail some kind of failure expectation exception is throw first

@teklakct
Copy link

Hi,

I have the same issue.
For me comment this line

protected function executeExample(SpecificationInterface $context, ExampleNode $example)
{
...
        try {
            $reflection->invokeArgs($context, $collaborators->getArgumentsFor($reflection));
        } catch (\Exception $e) {
//            $this->runMaintainersTeardown($maintainers, $example, $context, $matchers, $collaborators);
            throw $e;
        ...
    }

in file: spec/PhpSpec/Runner/ExampleRunnerSpec.php doesn't broke any spec.

I don't know how to figure out it at this moment.

@l3l0
Copy link
Contributor Author

l3l0 commented Jan 25, 2014

ping @MarcelloDuarte @everzet

Sorry guys but this is really annoying stuff. I was trying to fix that but right now I am not really sure how to do that.
I would like to call letgo maintainer (see #214) but does not call all expectations check maintainers after some exception is throwed (so exception will not be masked and generation will be possible again).

l3l0 added a commit to l3l0/phpspec that referenced this issue Jan 31, 2014
ciaranmcnulty added a commit that referenced this issue Feb 3, 2014
Fix issue #269 with exception masking and generation class/method bug
@l3l0
Copy link
Contributor Author

l3l0 commented Feb 5, 2014

Fixed in #276

@l3l0 l3l0 closed this as completed Feb 5, 2014
@teklakct
Copy link

teklakct commented Feb 5, 2014

Gratulacje !!! i wielkie dzięki

W dniu 05.02.2014 o 08:30 Leszek Prabucki notifications@github.com pisze:

Fixed in #276

Reply to this email directly or view it on GitHub.

Pozdrawiam,
Paweł Tekliński

mail: pawel@sixpoints.pl
mobile: +48 511 008 448
web: www.sixpoints.pl

@gquemener
Copy link
Contributor

Awesome! Thanks and good job @l3l0!!

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

No branches or pull requests

3 participants