Ejemplo n.º 1
0
 public function setUp()
 {
     parent::setUp();
     $this->ticket = m::mock('App\\Contracts\\Repositories\\TicketInterface');
     $this->action = m::mock('App\\Contracts\\Repositories\\TicketActionInterface');
     $this->faker = Faker::create();
 }
Ejemplo n.º 2
0
 public function tearDown()
 {
     if (file_exists(base_path('bootstrap/cache/compiled.php'))) {
         unlink(base_path('bootstrap/cache/compiled.php'));
     }
     parent::tearDown();
 }
 public function setUp()
 {
     parent::setUp();
     $this->runDatabaseMigrations();
     $this->seed();
     config(['modules.path' => base_path('nomodules')]);
 }
 public function setUp()
 {
     parent::setUp();
     $this->illuminateDispatcher = m::spy('Illuminate\\Events\\Dispatcher');
     $this->logger = m::spy('Illuminate\\Log\\Writer');
     $this->dispatcher = new EventDispatcher($this->illuminateDispatcher, $this->logger);
 }
Ejemplo n.º 5
0
 /**
  * Setup module configuration file.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     /* @noinspection PhpIncludeInspection */
     $this->modules = (require realpath(__DIR__ . '/../../../stub/tests/modules.php'));
     config(['modules' => $this->modules]);
 }
Ejemplo n.º 6
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new EmailParser();
     $this->user = m::mock('App\\Services\\Piper\\Pipes\\UserPipe');
     $this->org = m::mock('App\\Contracts\\Repositories\\OrgInterface');
 }
 public function tearDown()
 {
     parent::tearDown();
     if (is_dir($this->indexPath)) {
         rmdir_recursive($this->indexPath);
     }
 }
 public function setUp()
 {
     parent::setUp();
     $this->runner = m::mock('Nqxcode\\LuceneSearch\\Query\\Runner');
     $this->filter = m::mock('Nqxcode\\LuceneSearch\\Query\\Filter');
     $this->query = m::mock('ZendSearch\\Lucene\\Search\\Query\\Boolean');
     $this->rawQueryBuilder = m::mock('Nqxcode\\LuceneSearch\\Query\\RawQueryBuilder');
     $this->app->instance('Nqxcode\\LuceneSearch\\Query\\Runner', $this->runner);
     $this->app->instance('Nqxcode\\LuceneSearch\\Query\\Filter', $this->filter);
     $this->app->instance('ZendSearch\\Lucene\\Search\\Query\\Boolean', $this->query);
     $this->app->instance('Nqxcode\\LuceneSearch\\Query\\RawQueryBuilder', $this->rawQueryBuilder);
     $this->rawQueryBuilder->shouldReceive('build')->with($this->defaultFindOptions())->andReturn(['test', true]);
     $this->rawQueryBuilder->shouldReceive('parse')->with('test')->andReturn($this->luceneQuery = new Boolean())->byDefault();
     $this->query->shouldReceive('addSubquery')->with($this->luceneQuery, true);
     $lazyCollectionMock = m::mock(LazyCollection::make([1, 2, 3]));
     $lazyCollectionMock->shouldReceive('reload')->andReturn(Collection::make([1, 2, 3]))->byDefault();
     $this->runner->shouldReceive('models')->with($this->query)->andReturn($lazyCollectionMock)->byDefault();
     $this->runner->shouldReceive('total')->with($this->query)->andReturn(3)->byDefault();
     $this->runner->shouldReceive('models')->with($this->query, [])->andReturn($lazyCollectionMock)->byDefault();
     $this->runner->shouldReceive('models')->with($this->query, [])->andReturn($lazyCollectionMock)->byDefault();
     $this->runner->shouldReceive('total')->with($this->query, [])->andReturn(3)->byDefault();
     $this->runner->shouldReceive('run')->with($this->query)->andReturn([1, 2, 3, 4])->byDefault();
     $this->runner->shouldReceive('setCachedTotal')->byDefault();
     $this->runner->shouldReceive('setCachedModels')->byDefault();
     $this->runner->shouldReceive('getCachedTotal')->andReturn(null)->byDefault();
     $this->runner->shouldReceive('getCachedModels')->andReturn(null)->byDefault();
     $this->filter->shouldReceive('applyFilters')->with($this->query);
     $this->constructor = $this->app->make('Nqxcode\\LuceneSearch\\Query\\Builder');
 }
 public function setUp()
 {
     parent::setUp();
     $this->phpmorphyFactory = m::mock('Nqxcode\\Stemming\\PhpmorphyFactory');
     $this->phpmorphyFactory->shouldReceive('newInstance')->andReturn($phpmorphy = m::mock('\\phpMorphy'));
     $this->phpmorphy = $phpmorphy;
 }
Ejemplo n.º 10
0
 public function tearDown()
 {
     $user = \App\User::find(static::$idUser);
     if (null !== $user) {
         $user->delete();
     }
     parent::tearDown();
 }
 public function setUp()
 {
     parent::setUp();
     $this->search = m::mock('Nqxcode\\LuceneSearch\\Search');
     $this->app->instance('Nqxcode\\LuceneSearch\\Search', $this->search);
     $this->runner = $this->app->make('Nqxcode\\LuceneSearch\\Query\\Runner');
     $this->search->shouldReceive('index->find')->with('test')->andReturn([1, 2, 3, 4, 5]);
 }
Ejemplo n.º 12
0
 public function setUp()
 {
     parent::setUp();
     $this->stopwordsFilterFactory = m::mock('Nqxcode\\LuceneSearch\\Analyzer\\Stopwords\\FilterFactory');
     $this->analyzer = m::mock('ZendSearch\\Lucene\\Analysis\\Analyzer\\Common\\AbstractCommon');
     $this->app->instance('ZendSearch\\Lucene\\Analysis\\Analyzer\\Common\\AbstractCommon', $this->analyzer);
     $this->config = new Config(['filterClass1'], ['stopwordPath1'], $this->stopwordsFilterFactory);
 }
Ejemplo n.º 13
0
 public function setUp()
 {
     parent::setUp();
     $this->config = m::mock('Illuminate\\Config\\Repository');
     $this->auth = m::mock('Illuminate\\Auth\\AuthManager');
     $this->gate = m::mock('Illuminate\\Contracts\\Auth\\Access\\Gate');
     $this->menu = m::mock('Caffeinated\\Menus\\Menu');
     $this->cfg = ['Reports' => ['permissions' => ['isStaff'], 'url' => 'reports'], 'Home' => ['url' => 'home']];
 }
 public function setUp()
 {
     parent::setUp();
     $this->stub_datetime_generator = $this->stub(DateTimeGenerator::class);
     $this->stub_datetime_generator->generate()->willReturn('2014-10-10 00:00:00.000');
     $this->locker = $this->make_locker($this->stub_datetime_generator->reveal());
     $this->stream_id = new StreamID("b5c4aca8-95c7-4b2b-8674-ef7c0e3fd16f", "a955d32b-0130-463f-b3ef-23adec9af469");
     $this->locker->unlock($this->stream_id);
 }
 public function setUp()
 {
     parent::setUp();
     $this->configure();
     // Call migrations specific to our tests, e.g. to seed the db.
     Artisan::call('migrate', ['--database' => 'testbench', '--path' => '../tests/migrations']);
     // Call rebuild search index.
     Artisan::call('search:rebuild');
 }
 public function setUp()
 {
     parent::setUp();
     $this->faker = Faker::create();
     $this->user_model = factory(App\User::class)->make(['id' => $this->faker->randomNumber]);
     $this->be($this->user_model);
     $this->ticket = m::mock('App\\Contracts\\Repositories\\TicketInterface');
     // $this->user = m::mock('App\Contracts\Repositories\UserInterface');
 }
Ejemplo n.º 17
0
 /**
  * Sets up the required database connection and then runs the migrations.
  */
 public function setUp()
 {
     parent::setUp();
     $migrations = $this->app->make('migration.repository');
     $migrations->createRepository();
     $migrator = $this->app->make('migrator');
     $migrator->run(__DIR__ . '/../../resources/migrations');
     $this->setupAccount();
     $this->init();
 }
Ejemplo n.º 18
0
 public function tearDown()
 {
     $user = \App\User::find(static::$idUser);
     $tasks = \App\Task::where('user_id', '=', $user->id);
     $tasks->forceDelete();
     if (null !== $user) {
         $user->delete();
     }
     parent::tearDown();
 }
Ejemplo n.º 19
0
 public function setUp()
 {
     parent::setUp();
     $this->product = new Product();
     $this->product->id = 1;
     $this->product->name = 'test name';
     $this->dummy = new DummyModel();
     $this->dummy->id = 2;
     $this->dummy->name = 'another test name';
 }
Ejemplo n.º 20
0
 /**
  * Setup module configuration file.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     /* @noinspection PhpIncludeInspection */
     $this->ferrl = (require realpath(__DIR__ . '/../../../../stub/tests/ferrl.php'));
     /** @var View $factory */
     $factory = app(View::class);
     $factory->addNamespace('layouts', realpath(__DIR__ . '/../../../../stub/application/resources/layouts'));
     config(['ferrl' => $this->ferrl]);
 }
Ejemplo n.º 21
0
 /**
  * @author LAHAXE Arnaud
  *
  * @param string $login
  * @param string $password
  * @param int    $status
  *
  */
 public function login($login = '******', $password = '******', $status = 200)
 {
     $this->logout();
     parent::call('POST', '/api/v1/oauth/access_token', ['username' => $login, 'password' => $password, 'grant_type' => 'password', 'client_id' => 'versusmind', 'client_secret' => 'versusmind']);
     $this->seeJson([]);
     $this->seeStatusCode($status);
     if ($this->response->getStatusCode() == 200) {
         self::$oAuthCredentials = json_decode($this->response->getContent());
     }
 }
 public function setUp()
 {
     parent::setUp();
     $db = m::mock();
     $db->shouldReceive('connection->getSchemaBuilder->hasTable')->andReturn(true);
     $this->app->instance('db', $db);
     $result = $this->mockEloquentResults('App\\Config', [['key' => 'system.eyes', 'value' => 'a:1:{i:0;s:4:"blue";}', 'id' => 1], ['key' => 'system.hair', 'value' => 'a:1:{i:0;s:8:"brunette";}', 'id' => 2], ['key' => 'system.hottie', 'value' => 'a:1:{i:0;b:0;}', 'id' => 3], ['key' => 'system.legs', 'value' => 'long', 'id' => 3]]);
     $this->config = m::mock('App\\Repositories\\Eloquent\\ConfigRepository');
     $this->config->shouldReceive('all')->atMost(1)->andReturn($result);
     $this->app->instance('App\\Repositories\\ConfigInterface', $this->config);
 }
Ejemplo n.º 23
0
 public function setUp()
 {
     parent::setUp();
     $this->user = new User();
     $this->repo = m::mock('Bosnadev\\Repositories\\Contracts\\RepositoryInterface');
     $this->config = ['zombies' => ['admin' => true, 'mgr' => true, 'owner' => true, 'dept' => false], 'aliens' => ['admin' => false, 'dept' => true, 'assigned' => true, 'org' => true], 'monsters' => ['admin' => false, 'dept' => false, 'last' => true], 'vampires' => []];
     $this->app['config']->set('settings.notify', $this->config);
     $this->app['config']->set('settings.autorespond.bymail', false);
     $this->ticket = factory(App\Ticket::class)->make(['id' => 1234]);
     $this->ticket->dept = factory(App\Dept::class)->make();
 }
Ejemplo n.º 24
0
 public function setUp()
 {
     parent::setUp();
     $this->user = $this->userRepository->create(new \App\User(['username' => $this->faker->userName, 'email' => $this->faker->safeEmail, 'password' => $this->faker->password()]));
     $this->group = $this->groupRepository->create(new \App\Group(['name' => uniqid()]));
     $this->role = $this->roleRepository->create(new \App\Role(['name' => uniqid(), 'filter' => 'A']));
     $this->roleRevoke = $this->roleRepository->create(new \App\Role(['name' => uniqid(), 'filter' => 'R']));
     $this->permissionFirst = $this->permissionRepository->create(new \App\Permission(['area' => uniqid(), 'permission' => uniqid(), 'description' => 'test']));
     $this->permissionSecond = $this->permissionRepository->create(new \App\Permission(['area' => uniqid(), 'permission' => uniqid(), 'description' => 'test']));
     $this->resolver = new PermissionResolver();
 }
 public function setUp()
 {
     parent::setUp();
     $id_generator = new IDGenerator();
     $datetime_generator = new DateTimeGenerator();
     $this->event_builder = new EventBuilder($id_generator, $datetime_generator);
     $this->repo = $this->build_event_repository();
     $this->stream_event1 = $this->make_event("c91942f1-3c94-4900-a3b0-4497311e3503", "a955d32b-0130-463f-b3ef-23adec9af469");
     $this->stream_event2 = $this->make_event("b2527176-edcc-4db9-818a-9a4e5767f350", "a955d32b-0130-463f-b3ef-23adec9af469");
     $this->other_event = $this->make_event("11386b92-690e-4e15-8418-ff3c1688bad8", "343d56cf-6c4d-4d5d-9040-c7dd74ab65b9");
     $this->repo->store([$this->stream_event1, $this->stream_event2, $this->other_event]);
     $this->stream_id = new StreamID("b5c4aca8-95c7-4b2b-8674-ef7c0e3fd16f", "a955d32b-0130-463f-b3ef-23adec9af469");
 }
Ejemplo n.º 26
0
 protected function setUp()
 {
     parent::setUp();
     $this->client = $this->mockista->create('Drahak\\OAuth2\\Storage\\Clients\\IClientStorage');
     $this->clientEntity = $this->mockista->create('Drahak\\OAuth2\\Storage\\Clients\\IClient');
     $this->accessTokenEntity = $this->mockista->create('Drahak\\OAuth2\\Storage\\AccessTokens\\IAccessToken');
     $this->refreshTokenEntity = $this->mockista->create('Drahak\\OAuth2\\Storage\\RefreshTokens\\IRefreshToken');
     $this->accessToken = $this->mockista->create('Drahak\\OAuth2\\Storage\\AccessTokens\\AccessToken');
     $this->refreshToken = $this->mockista->create('Drahak\\OAuth2\\Storage\\RefreshTokens\\RefreshToken');
     $this->authorizationCode = $this->mockista->create('Drahak\\OAuth2\\Storage\\AuthorizationCodes\\AuthorizationCode');
     $this->token = $this->mockista->create('Drahak\\OAuth2\\Storage\\TokenContext');
     $this->input = $this->mockista->create('Drahak\\OAuth2\\Http\\IInput');
     $this->user = $this->mockista->create('Nette\\Security\\User');
 }
 public function setUp()
 {
     parent::setUp();
     $this->model = new DummyModel();
     $this->model->id = 1;
     $this->model->name = 'test name';
     $this->connection = m::mock('Nqxcode\\LuceneSearch\\Connection');
     $this->connection->shouldReceive('getIndexPath');
     $this->config = m::mock('Nqxcode\\LuceneSearch\\Model\\Config');
     $this->config->shouldReceive('privateKeyPair')->with($this->model)->andReturn(['private_key', 1]);
     $this->config->shouldReceive('classUidPair')->with($this->model)->andReturn(['class_uid', '12345']);
     $this->config->shouldReceive('fields')->with($this->model)->andReturn(['name']);
     $this->config->shouldReceive('optionalAttributes')->andReturn(['optional_attribute1' => 'optional value']);
 }
 public function setUp()
 {
     parent::setUp();
     $configs = $this->getValidConfigs();
     $modelFactory = m::mock('Nqxcode\\LuceneSearch\\Model\\Factory');
     $modelFactory->shouldReceive('newInstance')->with('tests\\models\\Product')->andReturn($this->productRepoMock = m::mock(new Product()));
     $this->productRepoMock->id = 1;
     $modelFactory->shouldReceive('newInstance')->with('tests\\models\\DummyModel')->andReturn($this->dummyRepoMock = m::mock(new DummyModel()));
     $this->dummyRepoMock->pk = 2;
     $modelFactory->shouldReceive('classUid')->with('tests\\models\\Product')->andReturn('1');
     $modelFactory->shouldReceive('classUid')->with('tests\\models\\DummyModel')->andReturn('2');
     $this->unknownRepoMock = m::mock('Illuminate\\Database\\Eloquent\\Model');
     $modelFactory->shouldReceive('classUid')->with(get_class($this->unknownRepoMock))->andReturn('999');
     $this->config = new Config($configs, $modelFactory);
 }
Ejemplo n.º 29
0
 /**
  * @dataProvider getFunctions
  *
  * @param string $functionName
  */
 public function testManuallyDb($functionName)
 {
     $reflection = $this->getReflector()->getFunction($functionName);
     if ($reflection) {
         try {
             $standardFunctionReflection = new \ReflectionFunction($functionName);
         } catch (\ReflectionException $e) {
             parent::markTestSkipped('Function doest not exist');
             return;
         }
         parent::assertSame($standardFunctionReflection->getNumberOfRequiredParameters(), $reflection->getNumberOfRequiredParameters());
         parent::assertSame($standardFunctionReflection->getNumberOfParameters(), $reflection->getNumberOfParameters());
         if ($reflection->getNumberOfParameters()) {
             foreach ($reflection->getParameters() as $key => $parameter) {
                 parent::assertSame($parameter, $reflection->getParameter($key));
                 parent::assertNotEmpty($parameter->getName());
                 parent::assertInternalType('integer', $parameter->getType());
                 parent::assertInternalType('boolean', $parameter->isRequired());
             }
         }
         return;
     }
     parent::markTestSkipped('Unknown manually reflection for function: ' . $functionName);
 }
Ejemplo n.º 30
0
 /**
  * Setup method
  **/
 public function setup()
 {
     parent::setup();
     $this->setupRepo();
 }