public function testEditDuplicate()
{
// Since we're the test user we won't automatically have permission to edit.
$permissions = $this->getMockPermissions();
$permissions->expects($this->any())->method('isAllowed')->will($this->returnValue(true));
$this->setService('permissions', $permissions);
$this->setRequest(Request::create('/bolt/editcontent/pages/4', 'GET', ['duplicate' => true]));
$original = $this->getService('storage')->getContent('pages/4');
$response = $this->controller()->edit($this->getRequest(), 'pages', 4);
$context = $response->getContext();
// Check that correct fields are equal in new object
$new = $context['context']['content'];
$this->assertEquals($new['body'], $original['body']);
$this->assertEquals($new['title'], $original['title']);
$this->assertEquals($new['teaser'], $original['teaser']);
// Check that some have been cleared.
$this->assertEquals('', $new['id']);
$this->assertEquals('', $new['slug']);
$this->assertEquals('', $new['ownerid']);
}