예제 #1
0
파일: TaskTest.php 프로젝트: weew/interop
 public function test_create_from_request()
 {
     $request = new HttpRequest();
     $request->setContent('foo');
     $task = FakeTask::fromHttpRequest($request);
     $this->assertEquals('foo', $task->getContent());
 }
예제 #2
0
파일: JsonDataTest.php 프로젝트: weew/http
 public function test_getters_and_setters()
 {
     $request = new HttpRequest();
     $data = new JsonData($request, ['foo' => 'bar']);
     $this->assertEquals('bar', $data->get('foo'));
     $this->assertNull($data->get('bar'));
     $data->set('bar', 'foo');
     $this->assertEquals('foo', $data->get('bar'));
     $this->assertFalse($data->has('yolo'));
     $data->set('yolo', 'swag');
     $this->assertTrue($data->has('yolo'));
     $data->remove('yolo');
     $this->assertFalse($data->has('yolo'));
     $data->extend(['foo' => 'foo', 'yolo' => 'swag']);
     $this->assertEquals(['foo' => 'foo', 'bar' => 'foo', 'yolo' => 'swag'], $data->getData());
     $this->assertTrue($data->hasData());
     $request->setContent(null);
     $this->assertFalse($data->hasData());
 }
예제 #3
0
 public function test_set_complex_content()
 {
     $response = new HttpRequest();
     $response->setContent([new ArrayableItem('foo'), new ArrayableItem('bar')]);
     $this->assertEquals([['id' => 'foo'], ['id' => 'bar']], $response->getData()->toArray());
 }