|
@@ 727-741 (lines=15) @@
|
| 724 |
|
$this->assertEquals(200, $response3->getStatusCode()); |
| 725 |
|
} |
| 726 |
|
|
| 727 |
|
public function testSelect() { |
| 728 |
|
$record = $this->objFromFixture('UploadFieldTest_Record', 'record1'); |
| 729 |
|
$file4 = $this->objFromFixture('File', 'file4'); |
| 730 |
|
$fileSubfolder = $this->objFromFixture('File', 'file-subfolder'); |
| 731 |
|
|
| 732 |
|
$response = $this->get('UploadFieldTest_Controller/Form/field/ManyManyFiles/select/'); |
| 733 |
|
$this->assertFalse($response->isError()); |
| 734 |
|
|
| 735 |
|
// A bit too much coupling with GridField, but a full template overload would make things too complex |
| 736 |
|
$parser = new CSSContentParser($response->getBody()); |
| 737 |
|
$items = $parser->getBySelector('.ss-gridfield-item'); |
| 738 |
|
$itemIDs = array_map(create_function('$el', 'return (int)$el["data-id"];'), $items); |
| 739 |
|
$this->assertContains($file4->ID, $itemIDs, 'Contains file in assigned folder'); |
| 740 |
|
$this->assertContains($fileSubfolder->ID, $itemIDs, 'Contains file in subfolder'); |
| 741 |
|
} |
| 742 |
|
|
| 743 |
|
public function testSelectWithDisplayFolderName() { |
| 744 |
|
$record = $this->objFromFixture('UploadFieldTest_Record', 'record1'); |
|
@@ 743-757 (lines=15) @@
|
| 740 |
|
$this->assertContains($fileSubfolder->ID, $itemIDs, 'Contains file in subfolder'); |
| 741 |
|
} |
| 742 |
|
|
| 743 |
|
public function testSelectWithDisplayFolderName() { |
| 744 |
|
$record = $this->objFromFixture('UploadFieldTest_Record', 'record1'); |
| 745 |
|
$file4 = $this->objFromFixture('File', 'file4'); |
| 746 |
|
$fileSubfolder = $this->objFromFixture('File', 'file-subfolder'); |
| 747 |
|
|
| 748 |
|
$response = $this->get('UploadFieldTest_Controller/Form/field/HasManyDisplayFolder/select/'); |
| 749 |
|
$this->assertFalse($response->isError()); |
| 750 |
|
|
| 751 |
|
// A bit too much coupling with GridField, but a full template overload would make things too complex |
| 752 |
|
$parser = new CSSContentParser($response->getBody()); |
| 753 |
|
$items = $parser->getBySelector('.ss-gridfield-item'); |
| 754 |
|
$itemIDs = array_map(create_function('$el', 'return (int)$el["data-id"];'), $items); |
| 755 |
|
$this->assertContains($file4->ID, $itemIDs, 'Contains file in assigned folder'); |
| 756 |
|
$this->assertNotContains($fileSubfolder->ID, $itemIDs, 'Does not contain file in subfolder'); |
| 757 |
|
} |
| 758 |
|
|
| 759 |
|
/** |
| 760 |
|
* Test that UploadField:overwriteWarning cannot overwrite Upload:replaceFile |