-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
124 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/Autocomplete/tests/Fixtures/Autocompleter/CustomAttributesProductAutocompleter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\UX\Autocomplete\Tests\Fixtures\Autocompleter; | ||
|
||
class CustomAttributesProductAutocompleter extends CustomProductAutocompleter | ||
{ | ||
public function getAttributes(object $entity): array | ||
{ | ||
return [ | ||
'disabled' => true, | ||
'value' => 'This value should be replaced with the result of getValue()', | ||
'text' => 'This value should be replaced with the result of getText()', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/Autocomplete/tests/Integration/AutocompleteResultsExecutorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\UX\Autocomplete\Tests\Integration; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Symfony\UX\Autocomplete\AutocompleteResultsExecutor; | ||
use Symfony\UX\Autocomplete\Tests\Fixtures\Autocompleter\CustomAttributesProductAutocompleter; | ||
use Symfony\UX\Autocomplete\Tests\Fixtures\Factory\ProductFactory; | ||
use Symfony\UX\Autocomplete\Tests\Fixtures\Kernel; | ||
use Zenstruck\Foundry\Test\Factories; | ||
use Zenstruck\Foundry\Test\ResetDatabase; | ||
|
||
class AutocompleteResultsExecutorTest extends KernelTestCase | ||
{ | ||
use Factories; | ||
use ResetDatabase; | ||
|
||
public function testItReturnsExtraAttributes(): void | ||
{ | ||
$kernel = new Kernel('test', true); | ||
$kernel->disableForms(); | ||
$kernel->boot(); | ||
|
||
$product = ProductFactory::createOne(['name' => 'Foo']); | ||
|
||
/** @var AutocompleteResultsExecutor $executor */ | ||
$executor = $kernel->getContainer()->get('public.results_executor'); | ||
$autocompleter = $kernel->getContainer()->get(CustomAttributesProductAutocompleter::class); | ||
$data = $executor->fetchResults($autocompleter, '', 1); | ||
$this->assertCount(1, $data->results); | ||
$this->assertSame(['disabled' => true, 'value' => $product->getId(), 'text' => 'Foo'], $data->results[0]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,13 +18,15 @@ | |
use Symfony\UX\LiveComponent\Test\InteractsWithLiveComponents; | ||
use Symfony\UX\LiveComponent\Tests\Fixtures\Component\Component2; | ||
use Symfony\UX\LiveComponent\Tests\Fixtures\Factory\CategoryFixtureEntityFactory; | ||
use Zenstruck\Foundry\Test\Factories; | ||
use Zenstruck\Foundry\Test\ResetDatabase; | ||
|
||
/** | ||
* @author Kevin Bond <[email protected]> | ||
*/ | ||
final class InteractsWithLiveComponentsTest extends KernelTestCase | ||
{ | ||
use Factories; | ||
use InteractsWithLiveComponents; | ||
use ResetDatabase; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,13 +14,15 @@ | |
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Symfony\UX\LiveComponent\Tests\Fixtures\Component\FormComponentWithManyDifferentFieldsType; | ||
use Symfony\UX\LiveComponent\Tests\Fixtures\Factory\CategoryFixtureEntityFactory; | ||
use Zenstruck\Foundry\Test\Factories; | ||
use Zenstruck\Foundry\Test\ResetDatabase; | ||
|
||
/** | ||
* @author Jakub Caban <[email protected]> | ||
*/ | ||
class ComponentWithFormTest extends KernelTestCase | ||
{ | ||
use Factories; | ||
use ResetDatabase; | ||
|
||
public function testFormValues(): void | ||
|