protected function RestfulPassThroughTestCase::validatePassThrough in RESTful 7.2
Same name and namespace in other branches
- 7 tests/RestfulPassThroughTestCase.test \RestfulPassThroughTestCase::validatePassThrough()
Validate the pass-through for different handlers.
Parameters
RestfulInterface $handler: The handler object.
array $base_request: The base request to create or update.
2 calls to RestfulPassThroughTestCase::validatePassThrough()
- RestfulPassThroughTestCase::testDbQuery in tests/
RestfulPassThroughTestCase.test - Test the pass-through property for an entity.
- RestfulPassThroughTestCase::testEntity in tests/
RestfulPassThroughTestCase.test - Test the pass-through property for an entity.
File
- tests/
RestfulPassThroughTestCase.test, line 58 - Contains RestfulPassThroughTestCase
Class
- RestfulPassThroughTestCase
- @file Contains RestfulPassThroughTestCase
Code
protected function validatePassThrough(\RestfulInterface $handler, array $base_request = array()) {
$request = $base_request;
$public_fields = $handler
->getPublicFields();
$public_fields['foo'] = array(
'create_or_update_passthrough' => TRUE,
);
$handler
->setPublicFields($public_fields);
$result = $handler
->post('', $request);
$this
->assertTrue($result[0]['id'], 'Object was created without a pass-through public field.');
$request['foo'] = 'bar';
$result = $handler
->post('', $request);
$this
->assertTrue($result[0]['id'], 'Object was created with a pass-through public field.');
// Assert update.
$id = $result[0]['id'];
$result = $handler
->put($id, $request);
$this
->assertTrue($result[0]['id'], 'Object was updated with a pass-through public field.');
}