Exemple #1
0
 public function test_data_type()
 {
     $request = new HttpRequest();
     $data = new JsonData($request);
     $this->assertNotEquals($data->getDataType(), $request->getContentType());
     $this->assertEquals(HttpDataType::JSON, $data->getDataType());
     $data->setDataType('foo');
     $this->assertEquals('foo', $data->getDataType());
 }
Exemple #2
0
 public function test_data_type()
 {
     $request = new HttpRequest();
     $data = new UrlEncodedData($request);
     $this->assertNotEquals($data->getDataType(), $request->getContentType());
     $this->assertEquals(HttpDataType::URL_ENCODED, $data->getDataType());
     $this->assertTrue($data->isUrlEncoded());
     $this->assertFalse($data->isMultipart());
     $data->setDataType(HttpDataType::MULTI_PART);
     $this->assertEquals(HttpDataType::MULTI_PART, $data->getDataType());
     $this->assertTrue($data->isMultipart());
     $this->assertFalse($data->isUrlEncoded());
 }
Exemple #3
0
 public function test_get_and_set_content_type()
 {
     $request = new HttpRequest();
     $this->assertEquals(null, $request->getContentType());
     $request->setContentType('foo/bar');
     $this->assertEquals('foo/bar', $request->getContentType());
 }