Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Add missing return statement. #7346

Merged
merged 4 commits into from
Mar 23, 2015
Merged

Add missing return statement. #7346

merged 4 commits into from
Mar 23, 2015

Conversation

ffraenz
Copy link
Contributor

@ffraenz ffraenz commented Mar 19, 2015

No description provided.

@fabiocarneiro
Copy link
Contributor

ohgodwhy?

@mwillbanks
Copy link
Contributor

Please supply a unit test so that this does not happen in the future.

@weierophinney
Copy link
Member

Um… it's only missing if you expect a fluent interface. Unfortunately, it's documented that way, so I can see why the expectation is there. :)

As @mwillbanks notes, please add a unit test so that we know the fluent contract exists and is expected.

@ffraenz
Copy link
Contributor Author

ffraenz commented Mar 19, 2015

This is the first time I am dealing with unit tests, so bear with me :)

@fabiocarneiro
Copy link
Contributor

@ffraenz You could use assertSame instead of assertEquals, so it will assert if the return is the same instance and not another instance of the same type.

Also i didn't see the point of asserting setFieldType in the same test. You could at least split it and make the test name more explicit, like ReturnsSameRendererInstanceWhenResolverIsSet and ReturnsSameRendererInstanceWhenFieldTypeIsSet.

@ffraenz
Copy link
Contributor Author

ffraenz commented Mar 19, 2015

@fabiocarneiro That makes perfect sense to me, thank's!

@Xerkus
Copy link
Member

Xerkus commented Mar 19, 2015

@weierophinney may be it will be better NOT to introduce fluent interface? It is kinda bad and that is not BC break since it never was there.

@fabiocarneiro
Copy link
Contributor

@Xerkus I agree with you, but some ppl consider docblocks change as bc break...


public function testReturnsSameRendererInstanceWhenResolverIsSet()
{
$returnValue = $this->renderer->setResolver(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

You will need to actually set a resolver here.

@weierophinney
Copy link
Member

@Xerkus I'd agree with you, except that this setter would then be inconsistent with the rest of the class, which does implement a fluent interface on existing setters. As such, I'd consider this a necessary fix.

@weierophinney weierophinney added this to the 2.4.0 milestone Mar 23, 2015
weierophinney added a commit that referenced this pull request Mar 23, 2015
Add missing return statement.
weierophinney added a commit that referenced this pull request Mar 23, 2015
@weierophinney weierophinney merged commit a8ccbb1 into zendframework:master Mar 23, 2015
weierophinney added a commit that referenced this pull request Mar 23, 2015
@ffraenz ffraenz deleted the patch-1 branch March 24, 2015 11:00
weierophinney added a commit to zendframework/zend-view that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-view that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants