| | 55 | |
| | 56 | public function dispatch() |
| | 57 | { |
| | 58 | $context = AgaviContext::getInstance(); |
| | 59 | |
| | 60 | $ro = $context->getRouting(); |
| | 61 | $ro->disable(); |
| | 62 | |
| | 63 | $rq = $context->getRequest(); |
| | 64 | $rq->setMethod($this->method); |
| | 65 | $ma = $rq->getParameter('module_accessor'); |
| | 66 | $aa = $rq->getParameter('action_accessor'); |
| | 67 | |
| | 68 | $this->arguments->setParameter($ma, $this->moduleName); |
| | 69 | $this->arguments->setParameter($aa, $this->actionName); |
| | 70 | |
| | 71 | $ctrl = $context->getController(); |
| | 72 | $ctrl->setParameter('send_response', false); |
| | 73 | $this->response = $ctrl->dispatch(); |
| | 74 | } |
| | 75 | |
| | 76 | public function setRequestMethod($method) |
| | 77 | { |
| | 78 | $this->method = $method; |
| | 79 | } |
| | 80 | |
| | 81 | public function assertValidationFailed($message = '') |
| | 82 | { |
| | 83 | |
| | 84 | } |
| | 85 | |
| | 86 | public function assertResponseHasTag($matcher, $message = '', $isHtml = true) |
| | 87 | { |
| | 88 | $this->assertTag($matcher, $this->response->getContent(), $message, $isHtml); |
| | 89 | } |
| | 90 | |
| | 91 | public function assertResponseHasNotTag($matcher, $message = '', $isHtml = true) |
| | 92 | { |
| | 93 | $this->assertNotTag($matcher, $this->response->getContent(), $message, $isHtml); |
| | 94 | } |
| | 96 | protected function setArguments(AgaviRequestDataHolder $arguments) |
| | 97 | { |
| | 98 | $this->arguments = $arguments; |
| | 99 | } |
| | 100 | |
| | 101 | /** |
| | 102 | * create a requestDataHolder with the given arguments and type |
| | 103 | * |
| | 104 | * arguments need to be passed in the way {@see AgaviRequestDataHolder} accepts them |
| | 105 | * |
| | 106 | * array(AgaviRequestDataHolder::SOURCE_PARAMETERS => array('foo' => 'bar')) |
| | 107 | * |
| | 108 | * if no type is passed, the default for the configured request class will be used |
| | 109 | * |
| | 110 | * @param array a two-dimensional array with the arguments |
| | 111 | * @param string the subclass of AgaviRequestDataHolder to create |
| | 112 | * |
| | 113 | * @return AgaviRequestDataHolder |
| | 114 | * |
| | 115 | * @author Felix Gilcher <felix.gilcher@bitextender.com> |
| | 116 | * @since 1.0.0 |
| | 117 | */ |
| | 118 | protected function createRequestDataHolder(array $arguments = array(), $type = null) |
| | 119 | { |
| | 120 | if(null === $type) { |
| | 121 | $type = AgaviContext::getInstance()->getRequest()->getParameter('request_data_holder_class', 'AgaviRequestDataHolder'); |
| | 122 | } |
| | 123 | |
| | 124 | $class = new $type($arguments); |
| | 125 | return $class; |
| | 126 | } |