Inheritance: extends PHPUnit_Framework_TestCase
Esempio n. 1
0
 public function setUp()
 {
     parent::setUp();
     if (!isset($GLOBALS['PHPUNIT_SA_LEARN_ENABLED']) || $GLOBALS['PHPUNIT_SA_LEARN_ENABLED'] == 0) {
         $this->markTestSkipped('To test the learning behavior, enable the TELL ' . 'command in SpamAssassin and update phpunit.xml');
     }
 }
Esempio n. 2
0
 function setup()
 {
     parent::setup();
     $app = Prado::getApplication();
     $this->userDao = $app->getModule('daos')->getDao('UserDao');
     $this->flushDatabase();
 }
 /**
  * Initialisation of config object
  *
  * @author 	Eddie Jaoude
  * @param 	null
  * @return 	null
  *
  */
 public function setup()
 {
     parent::setUp();
     $this->assertEquals(TRUE, is_object($this->_em));
     $this->model = $this->_em->getRepository('Auth_Model_Account');
     $this->appConfigAuth = new Zend_Config_Ini(APPLICATION_PATH . '/modules/auth/configs/auth.ini', APPLICATION_ENV);
 }
Esempio n. 4
0
 /**
  * Cleans up the environment after running a test.
  */
 protected function tearDown()
 {
     // TODO Auto-generated RW_App_Model_UploadTest::tearDown()
     $this->RW_App_Model_Upload = null;
     $this->clearApplicationData();
     parent::tearDown();
 }
 /**
  * Cleans up the environment after running a test.
  */
 protected function tearDown()
 {
     parent::tearDown();
     $this->dropTables();
     unset($this->Base);
     $this->clearApplicationData();
 }
 public function setUpPage()
 {
     $this->timeouts()->implicitWait(3000);
     if (!self::$indexed) {
         $this->url('/wp-admin/');
         if ('Vagrant › Log In' == $this->title()) {
             $this->byId('user_login')->click();
             $this->keys('admin');
             sleep(1);
             // some reason too fast?
             $this->byId('user_pass')->click();
             $this->keys('vagrant');
             $this->byId('wp-submit')->click();
         }
         $this->waitForTitle('Dashboard ‹ Vagrant — WordPress');
         $this->url('http://localhost:8080/wordpress/wp-admin/admin.php?page=elastic_search&tab=index');
         $this->assertEquals('ElasticSearch ‹ Vagrant — WordPress', $this->title());
         sleep(1);
         // some reason too fast?
         $this->byId('wipedata')->click();
         $this->byId('nhp-opts-save');
         sleep(1);
         $this->byId('reindex')->click();
         $this->byCssSelector(".complete");
         self::$indexed = true;
         // give index time to refresh, would rather call refresh on index directly, too lazy :)
         sleep(5);
     }
 }
 public function setUp()
 {
     parent::setUp();
     $this->status_column = 'status';
     $this->moderated_at_column = 'moderated_at';
     Post::$strictModeration = true;
 }
 public function setUp()
 {
     parent::setUp();
     $this->posts = new PostRepository();
     $this->artisan('migrate', ['--database' => 'testbench', '--realpath' => realpath(__DIR__ . '/../migrations')]);
     $this->withFactories(realpath(__DIR__ . '/../factories'));
 }
Esempio n. 9
0
 /**
  * Cleans up the environment after running a test.
  */
 protected function tearDown()
 {
     parent::tearDown();
     // Não inicializa o APPLICATION_DATA pois alguns testes exigem que ele não exista
     //@todo é possível ser condicional? teste case separado?
     // Remove as pastas criadas
     //$this->clearApplicationData();
 }
 public function setUp()
 {
     parent::setUp();
     \DB::enableQueryLog();
     $this->artisan('migrate', ['--database' => 'testbench', '--realpath' => realpath(__DIR__ . '/../migrations')]);
     $this->withFactories(realpath(__DIR__ . '/../factories'));
     $this->repo = new CachingRepository();
 }
Esempio n. 11
0
 /**
  * Cleans up the environment after running a test.
  */
 protected function tearDown()
 {
     parent::tearDown();
     $this->dropTables();
     unset($this->Db);
     // Remove as pastas criadas
     $this->clearApplicationData();
 }
Esempio n. 12
0
 public function setUp()
 {
     parent::setUp();
     $this->data = new Matrix(10, 10);
     $this->data->set(1, 1, 0);
     $this->data->set(1, 2, 0);
     $this->board = new Battleships\Board($this->data);
 }
Esempio n. 13
0
 function setup()
 {
     parent::setup();
     $app = Prado::getApplication();
     $this->categoryDao = $app->getModule('daos')->getDao('CategoryDao');
     $this->projectDao = $app->getModule('daos')->getDao('ProjectDao');
     $this->flushDatabase();
 }
 public function tearDown()
 {
     MysqlUser::truncate();
     MysqlBook::truncate();
     MysqlRole::truncate();
     Book::truncate();
     parent::tearDown();
 }
Esempio n. 15
0
 public function testUpdateOwnedIdentities()
 {
     parent::resetMongo();
     Doctrine::loadData(dirname(__FILE__) . '/fixtures');
     $lUserHugo = UserTable::getByIdentifier('hugo');
     $lUserHugo->updateOwnedIdentities(array("1", "2", "34"));
     $lRelation = $lUserHugo->retrieveUserRelations();
     $this->assertTrue(in_array("34", $lRelation->getOwnedOi()));
 }
Esempio n. 16
0
 public function setUp()
 {
     parent::resetMongo();
     sfConfig::set('sf_environment', 'test');
     Doctrine::loadData(dirname(__FILE__) . '/fixtures');
     sfConfig::set('sf_environment', 'dev');
     $this->from = date('Y-m-d', strtotime("today"));
     $this->to = date('Y-m-d', strtotime("tomorrow"));
 }
Esempio n. 17
0
 public function setUp()
 {
     parent::setUp();
     $this->requestor = new Requestor($this->client);
     // Attach mock requestor
     $httpClient = $this->requestor->getHttpClient();
     $stream = Stream::factory(json_encode([['id' => 'abcd1234', 'year' => 2001, 'make' => 'Volkswagen', 'model' => 'Passat', 'color' => '#fafafa', 'display_name' => 'My Passat']]));
     $mock = new Mock([new Response(200, [], $stream)]);
     $httpClient->getEmitter()->attach($mock);
 }
 /**
  * @inheritdoc
  */
 public function setUp()
 {
     parent::setUp();
     // $testConfig array
     $testConfig = (include __DIR__ . '/../config/config.php');
     $this->configManager = ConfigManager::create($testConfig);
     $this->basePath = realpath(__DIR__ . '/..');
     $this->storagePath = realpath(__DIR__ . '/../storage');
     $this->fileSystem = new FileSystem($this->configManager->get(), $this->basePath, $this->storagePath);
 }
 public function setUp()
 {
     parent::setUp();
     $this->status_column = 'status';
     $this->moderated_at_column = 'moderated_at';
     $this->moderated_by_column = 'moderated_by';
     //create a user and login
     $this->actingAsUser();
     Post::$strictModeration = true;
 }
 /**
  * @inheritdoc
  */
 public function setUp()
 {
     parent::setUp();
     $gettext = m::mock('Xinax\\LaravelGettext\\Gettext');
     $gettext->shouldReceive('getEncoding')->andReturn('UTF-8');
     $gettext->shouldReceive('setEncoding')->with('UTF-8');
     $gettext->shouldReceive('getLocale')->andReturn('en_US');
     $gettext->shouldReceive('setLocale')->with('en_US');
     $gettext->shouldReceive('filesystemStructure')->andReturn(true);
     $this->laravelGettext = new LaravelGettext($gettext);
 }
Esempio n. 21
0
 public function setUp()
 {
     parent::setUp();
     $filesystem = new Filesystem();
     $git = new Git();
     $git->init($this->directory);
     $git->setRepository($this->directory);
     $filesystem->dumpFile($this->directory . '/test.txt', '');
     $git->add('test.txt');
     $git->commit('Initial commit');
 }
 protected function setUp()
 {
     parent::setUp();
     update_option('server_url', 'http://127.0.0.1:9200/');
     update_option('server_index', 'travisci');
     $this->index = Indexer::_index(true);
     $this->index->create(array(), true);
     // make sure index is available before continuing
     Indexer::_client(true)->request('_cluster/health/travisci?wait_for_status=yellow', \Elastica\Request::GET);
     $this->assertEquals(0, $this->index->count());
 }
Esempio n. 23
0
    /**
     * Prepares the environment before running a test.
     */
    protected function setUp()
    {
        parent::setUp();
        $this->template = <<<END
<?php
\t\techo \$this->pubProp." ";
\t\t
\t\tif(!empty(\$this->prtProp))
\t\t\techo \$this->prtProp." ";
\t\t\t
\t\tif(!empty(\$this->pvtProp))
\t\t\techo \$this->pvtProp." ";
END;
    }
Esempio n. 24
0
 public function setUp()
 {
     parent::setUp();
     User::create(['name' => 'John Doe', 'age' => 35, 'title' => 'admin']);
     User::create(['name' => 'John Doe', 'age' => 5, 'title' => 'admin']);
     User::create(['name' => 'Jane Doe', 'age' => 33, 'title' => 'admin']);
     User::create(['name' => 'Harry Hoe', 'age' => 13, 'title' => 'user']);
     User::create(['name' => 'Robert Roe', 'age' => 37, 'title' => 'user']);
     User::create(['name' => 'Mark Moe', 'age' => 23, 'title' => 'user']);
     User::create(['name' => 'Brett Boe', 'age' => 35, 'title' => 'user']);
     User::create(['name' => 'Tommy Toe', 'age' => 33, 'title' => 'user']);
     User::create(['name' => 'Yvonne Yoe', 'age' => 35, 'title' => 'admin']);
     User::create(['name' => 'Error', 'age' => null, 'title' => null]);
 }
Esempio n. 25
0
 public function testClearApplicationData()
 {
     // Verifica se está tudo ok
     $this->BaseTestCase->setApplicationConstants();
     if (!is_writable(APPLICATION_DATA)) {
         $this->fail('APPLICATION_DATA ' . APPLICATION_DATA . ' não tem permissão de escrita');
     }
     // Grava umas bobeiras la
     $folder = APPLICATION_DATA . '/teste1';
     if (!file_exists($folder)) {
         $oldumask = umask(0);
         mkdir($folder);
         umask($oldumask);
     }
     file_put_contents($folder . '/test1.txt', 'teste');
     $folder = APPLICATION_DATA . '/teste2/teste3';
     if (!file_exists($folder)) {
         $oldumask = umask(0);
         mkdir($folder, 0777, true);
         umask($oldumask);
     }
     file_put_contents($folder . '/sample.txt', 'teste teste');
     // Verifica se a pasta está vazia
     $this->assertFalse($this->BaseTestCase->isApplicationDataEmpty());
     $this->BaseTestCase->clearApplicationData();
     // Verifica se está vazia
     $files = $objects = scandir(APPLICATION_DATA);
     $this->assertCount(3, $files, 'não tem mais nada no APPLICATION_DATA');
     $this->assertEquals(array('.', '..', '.gitignore'), $files, 'não tem mais nada no APPLICATION_DATA');
     // Verifica se a pasta está vazia
     $this->assertTrue($this->BaseTestCase->isApplicationDataEmpty());
     // Grava mais coisa no raiz do APPLICATION_DATA
     file_put_contents(APPLICATION_DATA . '/sample.txt', 'outro teste');
     // Verifica se a pasta está vazia depois de apagar
     $this->assertFalse($this->BaseTestCase->isApplicationDataEmpty());
     $this->assertTrue($this->BaseTestCase->clearApplicationData());
 }
Esempio n. 26
0
 function setUp()
 {
     parent::setUp();
     $this->Timepoint = $this->Factory->Timepoint("323");
     $this->Timepoint->method("getData")->will($this->returnCallback(function ($param) {
         if ($param === "SubprojectTitle") {
             return "Test Battery";
         }
     }));
     $this->Timepoint->method("getDateOfScreening")->willReturn("1934-03-20");
     $this->Timepoint->method("getScreeningStatus")->willReturn("Pass");
     $this->Timepoint->method("getDateOfVisit")->willReturn("1934-03-27");
     $this->Timepoint->method("getVisitStatus")->willReturn("Pass");
     $this->Timepoint->method("getDateOfApproval")->willReturn("1935-03-20");
     $this->Timepoint->method("getApprovalStatus")->willReturn("Failure");
 }
Esempio n. 27
0
 protected function setUp()
 {
     parent::setUp();
     $this->model = Model::load($this->modelName);
     $this->addTestTables = array();
     $this->addTestFilters = array();
     foreach ($this->addExpectedData["tables"] as $table) {
         $this->addTestTables[] = $table["name"];
         $this->addTestFilters[$table["name"]] = $table["filters"];
     }
     $this->deleteTestTables = array();
     $this->deleteTestFilters = array();
     foreach ($this->deleteExpectedData["tables"] as $table) {
         $this->deleteTestTables[] = $table["name"];
         $this->deleteTestFilters[$table["name"]] = $table["filters"];
     }
 }
Esempio n. 28
0
 public function setUp()
 {
     parent::setUp();
     // Config
     $testConfig = (include __DIR__ . '/../config/config.php');
     $config = ConfigManager::create($testConfig);
     // Session handler
     $session = m::mock('Xinax\\LaravelGettext\\Session\\SessionHandler');
     $session->shouldReceive('get')->andReturn('en_US');
     $session->shouldReceive('set')->with('en_US');
     // Framework adapter
     $adapter = m::mock('Xinax\\LaravelGettext\\Adapters\\LaravelAdapter');
     $adapter->shouldReceive('setLocale')->with('en_US');
     $adapter->shouldReceive('getApplicationPath')->andReturn(dirname(__FILE__));
     // FileSystem module
     $fileSystem = m::mock('Xinax\\LaravelGettext\\FileSystem');
     $fileSystem->shouldReceive('filesystemStructure')->andReturn(true);
     $fileSystem->shouldReceive('getDomainPath')->andReturn('path');
     $this->gettext = new Gettext($config->get(), $session, $adapter, $fileSystem);
 }
Esempio n. 29
0
 function setUp()
 {
     $this->getMockBuilder('Candidate')->setMockClassName("MockCandidate")->getMock();
     parent::setUp();
     $this->Candidate = $this->Factory->candidate(123456);
     $this->Candidate->method("getListOfVisitLabels")->willReturn(["VisitTwo"]);
     $this->Candidate->method("getCandidateGender")->willReturn("Male");
     $this->Candidate->method("getCandidateDoB")->willReturn("1900-02-20");
     $this->Candidate->method("getCandidateSite")->willReturn("Test");
     $this->Candidate->method("getPSCID")->willReturn("TestCandidate");
     $this->Candidate->method("getProjectTitle")->willReturn("loris");
     $this->Candidate->method("getListOfVisitLabels")->willReturn(["340" => "Test", '343' => "VisitTwo"]);
     $this->Database->method("pselectRow")->will($this->returnCallback(function ($query, $params) {
         if (strpos($query, "SELECT c.CenterID, c.CandID, c.") == 0 && $params == ['Candidate' => "123456"]) {
             return ['CenterID' => 1, "CandID" => 123456, "PSCID" => $this->Candidate->getPSCID(), "DoB" => $this->Candidate->getCandidateDoB(), "EDC" => null, "Gender" => $this->Candidate->getCandidateGender(), "PSC" => $this->Candidate->getCandidateSite()];
         }
         if (strpos($query, "SELECT MAX(c.Testdate) as CandChange") === 0) {
             return ['CandChange' => '24343', 'VisitChange' => '23433', 'VisitCount' => '3'];
         }
         return array();
     }));
 }
Esempio n. 30
0
 protected function tearDown()
 {
     Propel::setDB(null, $this->savedAdapter);
     parent::tearDown();
 }