Skip to content

Commit

Permalink
Add relational tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Firesphere committed Sep 9, 2019
1 parent 0967b37 commit 9c79538
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Tasks/SolrConfigureTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function run($request)
$this->configureIndex($index);
} catch (Exception $error) {
$this->getLogger()->error(sprintf('Core loading failed for %s', $index));
Debug::dump($error); // in browser mode, it might not always show
$this->getLogger()->error($error); // in browser mode, it might not always show
// Continue to the next index
continue;
}
Expand Down
16 changes: 14 additions & 2 deletions tests/unit/FieldResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\CMS\Model\VirtualPage;
use SilverStripe\Dev\Debug;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\ErrorPage\ErrorPage;

Expand Down Expand Up @@ -83,7 +82,20 @@ public function testGetFieldIntrospection()

$factory->setIndex($index);

Debug::dump($factory->resolveField('TestObject.TestRelation.Title'));
$expected = [
TestObject::class . '_TestObject_TestRelation_Title' =>
[
'name' => TestObject::class . '_TestObject_TestRelation_Title',
'field' => 'Title',
'fullfield' => 'TestObject_TestRelation_Title',
'origin' => TestObject::class,
'class' => TestRelationObject::class,
'type' => 'Varchar',
'multi_valued' => true,
],
];

$this->assertEquals($expected, $factory->resolveField('TestObject.TestRelation.Title'));
}

protected function setUp()
Expand Down

0 comments on commit 9c79538

Please sign in to comment.