|
@@ 477-490 (lines=14) @@
|
| 474 |
|
} |
| 475 |
|
|
| 476 |
|
|
| 477 |
|
public function testNoSearchableFieldsConfigured() { |
| 478 |
|
$config = Config::inst(); |
| 479 |
|
$sf = $config->get('FlickrPhotoTO', 'searchable_fields'); |
| 480 |
|
$config->remove('FlickrPhotoTO', 'searchable_fields'); |
| 481 |
|
$fp = Injector::inst()->create('FlickrPhotoTO'); |
| 482 |
|
try { |
| 483 |
|
$fp->getAllSearchableFields(); |
| 484 |
|
$this->fail("getAllSearchableFields should have failed as static var searchable_fields not configured"); |
| 485 |
|
} catch (Exception $e) { |
| 486 |
|
$this->assertEquals('The field $searchable_fields must be set for the class FlickrPhotoTO', $e->getMessage()); |
| 487 |
|
} |
| 488 |
|
|
| 489 |
|
$config->update('FlickrPhotoTO' ,'searchable_fields', $sf); |
| 490 |
|
} |
| 491 |
|
|
| 492 |
|
|
| 493 |
|
public function testNoSearchableFieldsConfiguredForHasManyRelation() { |
|
@@ 493-507 (lines=15) @@
|
| 490 |
|
} |
| 491 |
|
|
| 492 |
|
|
| 493 |
|
public function testNoSearchableFieldsConfiguredForHasManyRelation() { |
| 494 |
|
$config = Config::inst(); |
| 495 |
|
$sf = $config->get('FlickrTagTO', 'searchable_fields'); |
| 496 |
|
$config->remove('FlickrTagTO', 'searchable_fields'); |
| 497 |
|
$fp = Injector::inst()->create('FlickrPhotoTO'); |
| 498 |
|
try { |
| 499 |
|
$fp->getAllSearchableFields(); |
| 500 |
|
$this->fail("getAllSearchableFields should have failed as static var searchable_fields not configured"); |
| 501 |
|
} catch (Exception $e) { |
| 502 |
|
$this->assertEquals('The field $searchable_fields must be set for the class FlickrTagTO', $e->getMessage()); |
| 503 |
|
} |
| 504 |
|
|
| 505 |
|
$config->update('FlickrTagTO' ,'searchable_fields', $sf); |
| 506 |
|
|
| 507 |
|
} |
| 508 |
|
|
| 509 |
|
|
| 510 |
|
public function testNoSearchableFieldsConfiguredForHasOneRelation() { |
|
@@ 510-524 (lines=15) @@
|
| 507 |
|
} |
| 508 |
|
|
| 509 |
|
|
| 510 |
|
public function testNoSearchableFieldsConfiguredForHasOneRelation() { |
| 511 |
|
$config = Config::inst(); |
| 512 |
|
$sf = $config->get('FlickrAuthorTO', 'searchable_fields'); |
| 513 |
|
$config->remove('FlickrAuthorTO', 'searchable_fields'); |
| 514 |
|
$fp = Injector::inst()->create('FlickrPhotoTO'); |
| 515 |
|
try { |
| 516 |
|
$fp->getAllSearchableFields(); |
| 517 |
|
$this->fail("getAllSearchableFields should have failed as static var searchable_fields not configured"); |
| 518 |
|
} catch (Exception $e) { |
| 519 |
|
$this->assertEquals('The field $searchable_fields must be set for the class FlickrAuthorTO', $e->getMessage()); |
| 520 |
|
} |
| 521 |
|
|
| 522 |
|
$config->update('FlickrAuthorTO' ,'searchable_fields', $sf); |
| 523 |
|
|
| 524 |
|
} |
| 525 |
|
|
| 526 |
|
|
| 527 |
|
public function testSearchableMethodNotExist() { |