mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
removed duplicate RestfulServerTest files, they're already in /cms (merge error)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60236 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b89328e6cc
commit
4da0a2c52c
@ -58,6 +58,7 @@ class TestRunner extends Controller {
|
||||
* Run all test classes
|
||||
*/
|
||||
function all() {
|
||||
die("here");
|
||||
if(hasPhpUnit()) {
|
||||
$tests = ClassInfo::subclassesFor('SapphireTest');
|
||||
array_shift($tests);
|
||||
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package sapphire
|
||||
* @subpackage tests
|
||||
*/
|
||||
class RestfulServerTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/api/RestfulServerTest.yml';
|
||||
|
||||
function testCreate() {
|
||||
/*
|
||||
Disabled because it doesn't work in cli-script
|
||||
// Test GET
|
||||
$pageID = $this->idFromFixture('Page', 'page1');
|
||||
|
||||
$page1 = Director::test("api/v1/Page/$pageID", 'GET');
|
||||
$page1xml = new RestfulService_Response($page1->getBody(), $page1->getStatusCode());
|
||||
|
||||
// Test fields
|
||||
$this->assertEquals(200, $page1xml->getStatusCode());
|
||||
$this->assertEquals('First Page', (string)$page1xml->xpath_one('/Page/Title'));
|
||||
|
||||
// Test has_many relationships
|
||||
$comments = $page1xml->xpath('/Page/Comments/PageComment');
|
||||
$this->assertEquals(Director::absoluteURL('api/v1/PageComment/3'), (string)$comments[0]['href']);
|
||||
$this->assertEquals(Director::absoluteURL('api/v1/PageComment/4'), (string)$comments[1]['href']);
|
||||
$this->assertEquals(3, (string)$comments[0]['id']);
|
||||
$this->assertEquals(4, (string)$comments[1]['id']);
|
||||
|
||||
/// Test has_one relationships
|
||||
$parent = $page1xml->xpath_one('/Page/Parent');
|
||||
$this->assertEquals(Director::absoluteURL('api/v1/SiteTree/1'), (string)$parent['href']);
|
||||
$this->assertEquals(1, (string)$parent['id']);
|
||||
|
||||
$deletion = $service->get('Page/1', 'DELETE');
|
||||
if($deletion->successfulStatus()) {
|
||||
echo 'deleted';
|
||||
} else {
|
||||
switch($deletion->statusCode()) {
|
||||
case 403: echo "You don't have permission to delete that object"; break;
|
||||
default: echo "There was an error deleting"; break;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
PageComment:
|
||||
comment1:
|
||||
Name: Joe
|
||||
Comment: This is a test comment
|
||||
comment2:
|
||||
Name: Jane
|
||||
Comment: This is another test comment
|
||||
comment3:
|
||||
Name: Bob
|
||||
Comment: Another comment
|
||||
comment4:
|
||||
Name: Bob
|
||||
Comment: Second comment by Bob
|
||||
|
||||
Page:
|
||||
home:
|
||||
Title: Home
|
||||
Comments: =>PageComment.comment1,=>PageComment.comment2
|
||||
page1:
|
||||
Title: First Page
|
||||
Parent: =>Page.home
|
||||
Content: <p>Some test content</p>
|
||||
Comments: =>PageComment.comment3,=>PageComment.comment4
|
||||
page2:
|
||||
Title: Second Page
|
Loading…
Reference in New Issue
Block a user