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

assertTemplateName returns too early #3

Closed
weierophinney opened this issue Dec 31, 2019 · 1 comment · Fixed by #87
Closed

assertTemplateName returns too early #3

weierophinney opened this issue Dec 31, 2019 · 1 comment · Fixed by #87
Assignees
Labels
Bug Something isn't working

Comments

@weierophinney
Copy link
Member

assertTemplateName appears to return too early, and does not recursively search all child templates (see below).

<?php

public function myAction()
{
	$vm = new ViewModel();

	$child1 = (new ViewModel())->setTemplate('foo');
	$child2 = (new ViewModel())->setTemplate('bar');

	$vm->addChild($child1);
	$vm->addChild($child2);

	return $vm;
}

...

class testCase extends AbstractHttpControllerTestCase {
	
	public function testMyAction()
	{
		$this->dispatch('/my/action', 'GET', []);
		$this->assertTemplateName('foo'); // <-- true
		$this->assertTemplateName('bar'); // <-- false
	}

}

Originally posted by @SorX14 at zendframework/zend-test#59

@visto9259
Copy link
Contributor

visto9259 commented Sep 11, 2024

This is a very old issue but I was able to reproduce it with the latest version.
The function searchTemplates() cycles through the tree of children correctly except when a view has more than one child where it returns early if the first child's template does not match the asserted template.
Assign it to me and I will fix it.

@froschdesign froschdesign added the Bug Something isn't working label Sep 11, 2024
visto9259 added a commit to visto9259/laminas-test that referenced this issue Sep 12, 2024
Signed-off-by: Eric Richer [email protected] <[email protected]>
@Xerkus Xerkus closed this as completed Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants