Beispiel #1
0
 /**
  * @param  string                   $sendUser
  * @param  bool                     $onSuccess
  * @param  bool                     $onFailure
  * @throws PHPUnityoNoApiTokenError
  */
 public function __construct($sendUser, $onSuccess = false, $onFailure = false)
 {
     $apiToken = getenv('YO_API_TOKEN');
     if (empty($apiToken)) {
         throw new PHPUnityoNoApiTokenError('you should set Yo API token in ENV.');
     }
     TinyConfig::set('sendUser', $sendUser);
     TinyConfig::set('onSuccess', $onSuccess);
     TinyConfig::set('onFailure', $onFailure);
     TinyConfig::set('yo_api_token', $apiToken);
 }
            expect(TinyConfig::has('hello'))->to->ok();
        });
        it('should return false with unset value', function () {
            expect(TinyConfig::has('unknownKey'))->not->to->ok();
        });
    });
    context('getAll', function () {
        it('should all set values array', function () {
            $expected = ['hello' => 'world', 'foo' => 'bar'];
            expect(TinyConfig::getAll())->to->equal($expected);
        });
    });
    context('getKeys', function () {
        it('should return all keys array', function () {
            expect(TinyConfig::getKeys())->to->equal(['hello', 'foo']);
        });
    });
    context('delete', function () {
        it('should unset value', function () {
            TinyConfig::set('a', 'b');
            TinyConfig::delete('a');
            expect(TinyConfig::getKeys())->to->equal(['hello', 'foo']);
        });
    });
    context('delete all', function () {
        it('should unset all values', function () {
            TinyConfig::deleteAll();
            expect(TinyConfig::getAll())->to->empty();
        });
    });
});
Beispiel #3
0
 private function retryWithToken($times, $proc)
 {
     return (new Retry())->beforeEach(function () {
         TinyConfig::set('token', $this->getAccessToken());
     })->retry($times, $proc);
 }