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

Commit

Permalink
Merge branch 'hotfix/2660'
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Oct 3, 2012
2 parents 15bdeb0 + 9c0e2a0 commit 99da700
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/Zend/View/Strategy/JsonStrategy.php
Expand Up @@ -112,6 +112,8 @@ public function selectRenderer(ViewEvent $e)
}
return $this->renderer;
}

return ($model instanceof Model\JsonModel) ? $this->renderer : null;
}

/**
Expand Down
10 changes: 10 additions & 0 deletions tests/ZendTest/View/Strategy/JsonStrategyTest.php
Expand Up @@ -63,6 +63,16 @@ public function testJavascriptAcceptHeaderSelectsJsonStrategy()
$this->assertFalse($result->hasJsonpCallback());
}

public function testJsonModelMatchedAcceptHeaderMatchSelectsJsonStrategy()
{
$this->event->setModel(new JsonModel());
$request = new HttpRequest();
$request->getHeaders()->addHeaderLine('Accept', '*/*');
$this->event->setRequest($request);
$result = $this->strategy->selectRenderer($this->event);
$this->assertSame($this->renderer, $result);
}

public function testJsonModelJavascriptAcceptHeaderSetsJsonpCallback()
{
$this->event->setModel(new JsonModel());
Expand Down

0 comments on commit 99da700

Please sign in to comment.