예제 #1
0
 public function testCanDisableTranslationCapitalization()
 {
     $this->app['config'] = Mockery::mock('Config')->shouldReceive('get')->with('former.live_validation', '')->andReturn(true)->shouldReceive('get')->with('former.translate_from', '')->andReturn(true)->shouldReceive('get')->with('former.automatic_label', '')->andReturn(true)->shouldReceive('get')->with('former.capitalize_translations', '')->andReturn(false)->mock();
     Helpers::setApp($this->app);
     $this->assertEquals('field', Helpers::translate('field'));
 }
 /**
  * Bind Former classes to the container
  *
  * @param  Container $app
  *
  * @return Container
  */
 public function bindFormer(Container $app)
 {
     // Add config namespace
     $configPath = __DIR__ . '/../config/former.php';
     $this->mergeConfigFrom($configPath, 'former');
     $this->publishes([$configPath => $app['path.config'] . '/former.php']);
     $framework = $app['config']->get('former.framework');
     $app->bind('former.framework', function ($app) {
         return $app['former']->getFrameworkInstance($app['config']->get('former.framework'));
     });
     $app->singleton('former.populator', function ($app) {
         return new Populator();
     });
     $app->singleton('former.dispatcher', function ($app) {
         return new MethodDispatcher($app, Former::FIELDSPACE);
     });
     $app->singleton('former', function ($app) {
         return new Former($app, $app->make('former.dispatcher'));
     });
     $app->alias('former', 'Former\\Former');
     Helpers::setApp($app);
     return $app;
 }
예제 #3
0
 /**
  * Bind Former classes to the container
  *
  * @param  Container $app
  *
  * @return Container
  */
 public function bindFormer(Container $app)
 {
     // Add config namespace
     $app['config']->package('anahkiasen/former', __DIR__ . '/../config');
     $app->bind('former.framework', function ($app) {
         return $app['former']->getFrameworkInstance($app['config']->get('former::framework'));
     });
     $app->singleton('former.populator', function ($app) {
         return new Populator();
     });
     $app->singleton('former.dispatcher', function ($app) {
         return new MethodDispatcher($app, Former::FIELDSPACE);
     });
     $app->singleton('former', function ($app) {
         return new Former($app, $app->make('former.dispatcher'));
     });
     Helpers::setApp($app);
     return $app;
 }
예제 #4
0
 /**
  * Bind Former classes to the container.
  *
  * @param Container $app
  *
  * @return Container
  */
 public function bindFormer(Container $app)
 {
     $framework = $app['config']->get('former.framework');
     $app->bind('former.framework', function ($app) {
         return $app['former']->getFrameworkInstance($app['config']->get('former.framework'));
     });
     $app->singleton('former.populator', function ($app) {
         return new \Former\Populator();
     });
     $app->singleton('former.dispatcher', function ($app) {
         return new \Former\MethodDispatcher($app, \Former\Former::FIELDSPACE);
     });
     $app->singleton('former', function ($app) {
         return new \Former\Former($app, $app->make('former.dispatcher'));
     });
     $app->alias('former', 'Former\\Former');
     \Former\Helpers::setApp($app);
     return $app;
 }
예제 #5
0
 /**
  * Bind Former classes to the container
  *
  * @param  Container $app
  *
  * @return Container
  */
 public function bindFormer(Container $app)
 {
     // Add config namespace
     $app['config']->package('anahkiasen/former', __DIR__ . '/../config');
     // Get framework to use
     $framework = $app['config']->get('former::framework');
     $frameworkClass = '\\Former\\Framework\\' . $framework;
     $app->bind('former.framework', function ($app) use($frameworkClass) {
         return new $frameworkClass($app);
     });
     $app->singleton('former.populator', function ($app) {
         return new Populator();
     });
     $app->singleton('former', function ($app) {
         return new Former($app, new MethodDispatcher($app, Former::FIELDSPACE));
     });
     Helpers::setApp($app);
     return $app;
 }