Skip to content

Commit

Permalink
Added tests for the new feature
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Feb 10, 2018
1 parent f136e6f commit 851fce9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/Controller/CustomizedBackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,21 @@ public function testSearchViewShowActionReferer()
$this->assertSame($parameters, $refererParameters);
}

public function testSearchUsingAssociations()
{
$parameters = array(
'action' => 'search',
'entity' => 'Purchase',
'page' => '1',
'query' => 'user9@example',
);

$crawler = $this->getBackendPage($parameters);

$this->assertSame('user9', trim($crawler->filter('.table tbody tr td[data-label="Buyer"]')->eq(0)->text()));
$this->assertContains('sorted', $crawler->filter('.table th[data-property-name="buyer"]')->eq(0)->attr('class'));
}

public function testListViewVirtualFields()
{
$crawler = $this->requestListView('Product');
Expand Down
5 changes: 5 additions & 0 deletions tests/Fixtures/App/config/config_customized_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,13 @@ easy_admin:
list:
fields:
- id
- buyer
- billingAddress
- { property: 'deliveryDate', format: 'Ymd' }
- { property: 'deliveryHour', format: 'H:i' }
search:
fields: ['guid', 'billingAddress', 'buyer.email']
sort: ['buyer.email', ASC]
PurchaseItem:
class: AppTestBundle\Entity\FunctionalTests\PurchaseItem
label: 'Purchase Items'
Expand Down

0 comments on commit 851fce9

Please sign in to comment.