Codeception / module-datafactory

DataFactory module for Codeception
MIT License
9 stars 7 forks source link

DataFactory Module setLocale Not Working #5

Open dimacros opened 5 years ago

dimacros commented 5 years ago

I want to change the locale of Faker

Config Extended DataFactory.php

The setLocale configuration is specified in the package: https://github.com/thephpleague/factory-muffin


namespace Helper;

use Codeception\Module\DataFactory as BaseDataFactory;
use League\FactoryMuffin\Faker\Facade as Faker;

class DataFactory extends BaseDataFactory
{
    public function _beforeSuite($settings = [])
    {
        parent::_beforeSuite($settings);

        Faker::setLocale('es_PE'); //Not Working
    }
}

Details

class_name: ApiTester
modules:
    enabled:
        - Symfony:
            app_path: 'app'
            var_path: 'var'
            environment: 'test'
        - REST:
            url: /api
            depends: Symfony
        - Doctrine2:
            cleanup: true
            depends: Symfony
        - Helper\DataFactory:
            cleanup: true
            depends: Doctrine2
            factories: tests/_support/factories
        - \Helper\Api