178 search results

Hey Tien dat L. Foundry is expecting the Question class to have a way to set the tags, in this case it's expecting a public `setTags()` method. Could you check if that method exist? Cheers!
MolloKhan
MolloKhan
Read Full Comment
Hey Brainiac, Yes, Foundry definitely adds more overhead into your project than just simple fixtures, but it also provides more features out of the box. To know more about the features it brings - please, watch this screencast. Also, in the next video we cover some…
// ... lines 1 - 4
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;
class LockDownHelperTest extends KernelTestCase
{
use ResetDatabase, Factories;
}
See Code Block in Script
16 lines | tests/Functional/UserResourceTest.php
// ... lines 1 - 2
namespace App\Tests\Functional;
use Zenstruck\Foundry\Test\ResetDatabase;
class UserResourceTest extends ApiTestCase
{
use ResetDatabase;
// ... lines 10 - 14
}
See Code Block in Script
Hey all, this should be fixed in Foundry v1.1.2 (https://github.com/zenstruck/foundry/releases/tag/v1.1.2) - I allow doctrine/persistence v2
54 lines | src/Factory/QuestionFactory.php
// ... lines 1 - 20
final class QuestionFactory extends ModelFactory
{
// ... lines 23 - 35
protected function initialize(): self
{
// see https://github.com/zenstruck/foundry#initialization
return $this
->afterInstantiate(function(Question $question) {
if (!$question->getSlug()) {
// ... lines 42 - 43
}
})
;
}
// ... lines 48 - 52
}
See Code Block in Script
54 lines | src/Factory/QuestionFactory.php
// ... lines 1 - 20
final class QuestionFactory extends ModelFactory
{
// ... lines 23 - 40
protected function initialize(): self
{
// see https://github.com/zenstruck/foundry#initialization
return $this
//->afterInstantiate(function(Question $question) { });
;
}
// ... lines 48 - 52
}
See Code Block in Script
Hey Ruslan, No problem :) Btw, you can use ResetDatabase trait from Foundry lib in your tests to automatically prepare test DB before each test :) Cheers!
…, Indeed, I used foundry v2.1.0 and browser v1.9.0. I ran `composer update zenstruck/browser`, which brought my browser version to 1.9.1 and it seems to solve the issue. I can now use `browser->actingAs($user)` with `$user` generated with…
… Can you tell me what version of `zenstruck/browser` & `zenstruck/foundry` you are using? ``` composer show zenstruck/browser composer show zenstruck/foundry ``` (I'm thinking you may be on foundry 2+ but your browser version does not support it yet - I'm hoping upgrading `zenstruck…
I reviewed that documentation yes, thank you. It was not clear to me that foundry was *only* for fixtures, as it's use of the 'factory' namespace (to me at least) implies it's purpose as a non-fixture factory also. I was looking to…
Hey Rufnex, Yep, exactly like Ruslan mentioned below in https://symfonycasts.com/screencast/symfony-doctrine/foundry#comment-27727 I.e. you create a faker instance manually via `$faker = Factory::create('fr_FR');` passing the desired locale and then use it below. Cheers!
…talking about how to localize Faker with the Foundry bundle - here's an example: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#faker . As you can see from the docs, you can do it via Symfony configuration: ```yaml # config/packages/zenstruck_foundry.yaml when@dev: #…
Hallo, i habe a issue with Relation ManyToMany in Foundry 1.21 and Symfony 6 in AppFixtrures: ` TagFactory::createMany(100); $questions = QuestionFactory::createMany(20, function() { return [ 'tags' => TagFactory::randomRange(0, 5), ]; }); ` i got error from doctrine orm : Cannot set attribute "tags" for object…
Tien dat L.
Tien dat L.
Read Full Comment
Struggling with this one. I keep getting the error "The class 'Zenstruck\Foundry\Proxy' was not found in the chain configured namespaces App\Entity" and there are some deprecation warnings if I turn the volume up (-vvv). It happens when I add this code: ` $tag1…
Hey Dang! Yes, mo Foundry is much better than Alice. Foundry didn't exist when I wrote the earlier tutorials that used Alice. I now *much* prefer Foundry of Alice :). So use it instead! Cheers!
weaverryan
weaverryan
Read Full Comment
Oh, yes! We will cover that - just not using Foundry specifically inside of tests :).
weaverryan
weaverryan
Read Full Comment
Hey @Farry7! Right here: https://symfonycasts.com/screencast/symfony-doctrine/foundry Cheers!
weaverryan
weaverryan
Read Full Comment
Hi! I'm trying to work my way around Foundry but I'm facing two issues. First one: I'd like to create dummy users and I've got a `password` property. So I tried to emulate the Symfony Doc tip to encode password into…
Utilisateur
Utilisateur
Read Full Comment
…C.! > So if I see this right zenstruck/foundry acts as a replacement for the hautelook/AliceBundle 💯 I have not been very happy with Alice for awhile now, and have been looking for replacements. Foundry even has (via a simple trait, similar to…
weaverryan
weaverryan
Read Full Comment