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

Chainable set() #5392

Merged
merged 5 commits into from Dec 13, 2014
Merged

Chainable set() #5392

merged 5 commits into from Dec 13, 2014

Conversation

dereuromark
Copy link
Member

PR for #5318

As suggested makes following possible:

$this->cell('Cell::method', ....)
    ->set('key1', $variable1)
    ->set('key2', $variable2);

@dereuromark dereuromark added this to the 3.0.0 milestone Dec 11, 2014
@markstory markstory added the view label Dec 12, 2014
@markstory
Copy link
Member

Test please.

public function testSetChained() {
$this->subject->set('testing', 'value')
->set('foo', 'bar');
$this->assertEquals(['testing' => 'value', 'foo' => 'bar'], $this->subject->viewVars);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add an assert to check type of return value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why such a test fails? Maybe we need to use a real class instead of a trait?
https://travis-ci.org/cakephp/cakephp/jobs/43793912#L231

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't use instanceof on traits. You could assertSame($this->subject $result); though.

@lorenzo
Copy link
Member

lorenzo commented Dec 13, 2014

Thanks :)

lorenzo added a commit that referenced this pull request Dec 13, 2014
@lorenzo lorenzo merged commit 43f053f into 3.0 Dec 13, 2014
@lorenzo lorenzo deleted the 3.0-viewvars branch December 13, 2014 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants