Exemplo n.º 1
0
 public function test_create_data_for_content_type()
 {
     $request = new HttpRequest();
     $matcher = new ContentTypeDataMatcher();
     $data = $matcher->createDataForContentType($request, 'foo');
     $this->assertTrue($data instanceof UrlEncodedData);
     $data = $matcher->createDataForContentType($request, 'application/json');
     $this->assertTrue($data instanceof JsonData);
     $data = $matcher->createDataForContentType($request, 'application/json;charset=UTF-8');
     $this->assertTrue($data instanceof JsonData);
     $data = $matcher->createDataForContentType($request, ' application/json ;charset=UTF-8');
     $this->assertTrue($data instanceof JsonData);
 }
Exemplo n.º 2
0
 /**
  * @return UrlEncodedData
  */
 protected function createData()
 {
     $matcher = new ContentTypeDataMatcher();
     return $matcher->createDataForContentType($this, $this->getContentType());
 }