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

Possible bug with the aura closure view #54

Closed
harikt opened this issue May 17, 2014 · 8 comments
Closed

Possible bug with the aura closure view #54

harikt opened this issue May 17, 2014 · 8 comments

Comments

@harikt
Copy link
Member

harikt commented May 17, 2014

Hi Paul,

I was just playing around to learn and implement ADR in aura. See https://github.com/harikt/adr/commit/f7f79e898d182c4fb9e0222044b9d1224e3498ad

In that I was writing a test on the render functionality done with aura/view. I am seeing something like

PHPUnit 4.0.13 by Sebastian Bergmann.

Configuration read from /var/www/adr/tests/phpunit.xml

E.

Time: 30 ms, Memory: 3.75Mb

There was 1 error:

1) Aura\Action_Bundle\AuraViewTest::testRenderHello
Missing argument 1 for Aura\View\View::Aura\Action_Bundle\{closure}()

/var/www/adr/tests/src/AuraViewTest.php:17
/var/www/adr/vendor/aura/view/src/View.php:58
/var/www/adr/vendor/aura/view/src/View.php:58
/var/www/adr/vendor/aura/view/src/View.php:32
/var/www/adr/src/AuraView.php:24
/var/www/adr/tests/src/AuraViewTest.php:38

FAILURES!
Tests: 2, Assertions: 1, Errors: 1.

This sounds to me that there is some sort of bug in the View.

@pmjones
Copy link
Member

pmjones commented May 19, 2014

Have you found out anything more about this?

@harikt
Copy link
Member Author

harikt commented May 19, 2014

nope. What I feel is about the closure being used inside another class makes the bind call on that particular class. That is a guess, not really something I found.

@pmjones
Copy link
Member

pmjones commented May 19, 2014

It is true that each closure template has $this bound to the View instance.

@harikt
Copy link
Member Author

harikt commented May 19, 2014

So closures will not work the way expected makes it not usable.

@pmjones
Copy link
Member

pmjones commented May 19, 2014

How is that not expected? Normally a closure has no $this to begin with.

@harikt
Copy link
Member Author

harikt commented May 19, 2014

@pmjones I am wrong. I did a

$view_registry->set('hello', function ($name) {
    return "Hello {$name}";
});

Which was entirely wrong. May be the templates I created was old ones or may be via copy and paste got into it.

@harikt
Copy link
Member Author

harikt commented May 19, 2014

I copied from the tests 2441295 . My bad.

@pmjones
Copy link
Member

pmjones commented May 19, 2014

Ahh yes, I can see where that would be a problem. I should document that function params will not work with closures.

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

2 participants