Permalink
Browse files

MINOR Making controller/response optional in CMSBatchAction->batchact…

…ion() in order to make the class more testable in isolation

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@115128 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 2afc2e9 commit 2d3bb7de3e0828eb133ed020da10bfe502501474 @chillu chillu committed Dec 16, 2010
Showing with 7 additions and 4 deletions.
  1. +7 −4 code/CMSBatchAction.php
View
@@ -64,10 +64,13 @@ public function batchaction(DataObjectSet $pages, $helperMethod, $successMessage
unset($page);
}
- Controller::curr()->getResponse()->setStatusCode(
- 200,
- sprintf($successMessage, $pages->Count(), count($status['error']))
- );
+ $response = Controller::curr()->getResponse();
+ if($response) {
+ $response->setStatusCode(
+ 200,
+ sprintf($successMessage, $pages->Count(), count($status['error']))
+ );
+ }
return Convert::raw2json($status);
}

0 comments on commit 2d3bb7d

Please sign in to comment.