| @@ 115-131 (lines=17) @@ | ||
| 112 | $this->assertEquals('testItCreatesFolder', $newFolder->Name); |
|
| 113 | } |
|
| 114 | ||
| 115 | public function testItRestrictsCreateFolderByCanCreate() |
|
| 116 | { |
|
| 117 | $folder = $this->objFromFixture(Folder::class, 'folder1'); |
|
| 118 | ||
| 119 | $response = Director::test( |
|
| 120 | 'admin/assets/api/createFolder', |
|
| 121 | [ |
|
| 122 | 'ParentID' => $folder->ID, |
|
| 123 | 'Name' => 'disallowCanCreate', |
|
| 124 | 'SecurityID' => SecurityToken::inst()->getValue(), |
|
| 125 | ], |
|
| 126 | $this->session, |
|
| 127 | 'POST' |
|
| 128 | ); |
|
| 129 | $this->assertTrue($response->isError()); |
|
| 130 | $this->assertEquals(403, $response->getStatusCode()); |
|
| 131 | } |
|
| 132 | ||
| 133 | public function testItRestrictsCreateFolderByCanAddChildren() |
|
| 134 | { |
|
| @@ 133-149 (lines=17) @@ | ||
| 130 | $this->assertEquals(403, $response->getStatusCode()); |
|
| 131 | } |
|
| 132 | ||
| 133 | public function testItRestrictsCreateFolderByCanAddChildren() |
|
| 134 | { |
|
| 135 | $folder = $this->objFromFixture(Folder::class, 'disallowCanAddChildren'); |
|
| 136 | ||
| 137 | $response = Director::test( |
|
| 138 | 'admin/assets/api/createFolder', |
|
| 139 | [ |
|
| 140 | 'ParentID' => $folder->ID, |
|
| 141 | 'Name' => 'testItRestrictsCreateFolderByCanAddChildren', |
|
| 142 | 'SecurityID' => SecurityToken::inst()->getValue(), |
|
| 143 | ], |
|
| 144 | $this->session, |
|
| 145 | 'POST' |
|
| 146 | ); |
|
| 147 | $this->assertTrue($response->isError()); |
|
| 148 | $this->assertEquals(403, $response->getStatusCode()); |
|
| 149 | } |
|
| 150 | ||
| 151 | public function testItCreatesFile() |
|
| 152 | { |
|