tests/SmsServiceProvider.php
/**
     * Register bindings in the container.
     */
Register bindings in the container.
Register bindings in the container .
public function register()
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/laravel-ovh-sms.php',
            'laravel-ovh-sms'
        );
        $config = $this->app['config']->get('laravel-ovh-sms');
        $this->app->singleton(Sms::class, function ($app) use ($config) {
            $smsApi = Mockery::mock(SmsApi::class);
            $smsApi->shouldReceive('getAccounts')
                ->andReturn(['dummy_sms_account']);
            $smsApi->shouldReceive('setAccount')
                ->andReturn(true);
            $smsApi->shouldReceive('setUser')
                ->andReturn(true);
            $smsApi->shouldReceive('getSenders')
                ->andReturn(['dummy_sms_default_sender']);
            return new OvhSms($smsApi, $config);
        });
    }
public function register ( ) { $ this -> mergeConfigFrom ( __DIR__ . '/../config/laravel-ovh-sms.php' , 'laravel-ovh-sms' ) ; $ config = $ this -> app [ 'config' ] -> get ( 'laravel-ovh-sms' ) ; $ this -> app -> singleton ( Sms :: class , function ( $ app ) use ( $ config ) { $ smsApi = Mockery :: mock ( SmsApi :: class ) ; $ smsApi -> shouldReceive ( 'getAccounts' ) -> andReturn ( [ 'dummy_sms_account' ] ) ; $ smsApi -> shouldReceive ( 'setAccount' ) -> andReturn ( true ) ; $ smsApi -> shouldReceive ( 'setUser' ) -> andReturn ( true ) ; $ smsApi -> shouldReceive ( 'getSenders' ) -> andReturn ( [ 'dummy_sms_default_sender' ] ) ; return new OvhSms ( $ smsApi , $ config ) ; } ) ; }
Register bindings in the container.
Register bindings in the container .
// merge config // resolve OvhSms as a singleton // mock Sms Api