| @@ 196-208 (lines=13) @@ | ||
| 193 | $this->assertEquals(Director::baseURL() . ASSETS_DIR . '/FileTest.txt', $file->Link()); |
|
| 194 | } |
|
| 195 | ||
| 196 | public function testGetRelativePath() { |
|
| 197 | $rootfile = $this->objFromFixture('File', 'asdf'); |
|
| 198 | $this->assertEquals('assets/FileTest.txt', $rootfile->getRelativePath(), 'File in assets/ folder'); |
|
| 199 | ||
| 200 | $subfolderfile = $this->objFromFixture('File', 'subfolderfile'); |
|
| 201 | $this->assertEquals('assets/FileTest-subfolder/FileTestSubfolder.txt', $subfolderfile->getRelativePath(), |
|
| 202 | 'File in subfolder within assets/ folder, with existing Filename'); |
|
| 203 | ||
| 204 | $subfolderfilesetfromname = $this->objFromFixture('File', 'subfolderfile-setfromname'); |
|
| 205 | $this->assertEquals('assets/FileTest-subfolder/FileTestSubfolder2.txt', |
|
| 206 | $subfolderfilesetfromname->getRelativePath(), |
|
| 207 | 'File in subfolder within assets/ folder, with Filename generated through setName()'); |
|
| 208 | } |
|
| 209 | ||
| 210 | public function testGetFullPath() { |
|
| 211 | $rootfile = $this->objFromFixture('File', 'asdf'); |
|
| @@ 922-930 (lines=9) @@ | ||
| 919 | $this->assertEmpty($fields); |
|
| 920 | } |
|
| 921 | ||
| 922 | public function testCastingHelper() { |
|
| 923 | $team = $this->objFromFixture('DataObjectTest_Team', 'team1'); |
|
| 924 | ||
| 925 | $this->assertEquals('Varchar', $team->castingHelper('Title'), 'db field wasn\'t casted correctly'); |
|
| 926 | $this->assertEquals('HTMLVarchar', $team->castingHelper('DatabaseField'), 'db field wasn\'t casted correctly'); |
|
| 927 | ||
| 928 | $sponsor = $team->Sponsors()->first(); |
|
| 929 | $this->assertEquals('Int', $sponsor->castingHelper('SponsorFee'), 'many_many_extraFields not casted correctly'); |
|
| 930 | } |
|
| 931 | ||
| 932 | public function testSummaryFieldsCustomLabels() { |
|
| 933 | $team = $this->objFromFixture('DataObjectTest_Team', 'team1'); |
|