public function setUp() { $this->getFixtureManager()->resetTable('article'); $this->getFixtureManager()->loadFixture('article'); exec('./setup.sh'); parent::setUp(); }
public function setUp() { $this->getFixtureManager()->resetTable('order'); $this->getFixtureManager()->loadFixture('order'); CActiveRecord::$db = $this->db = Yii::app()->db; parent::setUp(); }
public function setUp() { parent::setUp(); $this->date = $date = date('YmdHi'); $this->mock = $this->getMockBuilder('NodExportController')->disableOriginalConstructor()->getMock(); $this->mock->method('createAllTempTables'); $reflectionClass = new ReflectionClass('NodExportController'); $institutionCode = $reflectionClass->getProperty('institutionCode'); $institutionCode->setAccessible(true); $institutionCode->setValue($this->mock, Yii::app()->params['institution_code']); $exportPath = $reflectionClass->getProperty('exportPath'); $exportPath->setAccessible(true); $exportPath->setValue($this->mock, realpath(dirname(__FILE__) . '/../../../') . '/runtime/nod-export/test/' . $institutionCode->getValue($this->mock) . '/' . $this->date); $zipName = $reflectionClass->getProperty('zipName'); $zipName->setAccessible(true); $zipName->setValue($this->mock, $institutionCode->getValue($this->mock) . '_' . $this->date . '_NOD_Export.zip'); $this->controller = $reflectionClass; $this->exportPath = $exportPath->getValue($this->mock); $this->zipName = $zipName->getValue($this->mock); if (!file_exists($exportPath->getValue($this->mock))) { mkdir($exportPath->getValue($this->mock), 0777, true); } $createAllTempTablesmethod = $this->controller->getMethod('createAllTempTables'); $createAllTempTablesmethod->setAccessible(true); $createAllTempTablesmethod->invoke($this->mock); }
public function setUp() { $this->original_service_manager = Yii::app()->service; $this->service_manager = new ServiceManagerWrapper2(); Yii::app()->setComponent('service', $this->service_manager); parent::setUp(); }
public function setUp() { parent::setUp(); $this->cleanDirectories(); require_once dirname(__FILE__) . '/../../../commands/ImportLegacyVFCommand.php'; $this->archiveDir = sys_get_temp_dir() . '/openeyes_vis_fields_tmp_archive'; $this->errorDir = sys_get_temp_dir() . '/openeyes_vis_fields_tmp_error'; $this->dupDir = sys_get_temp_dir() . '/openeyes_vis_fields_tmp_dups'; $this->importDir = sys_get_temp_dir() . '/openeyes_vis_fields_tmp_in'; $this->originalImportDir = dirname(__FILE__) . '/../../fields/legacy'; if (!file_exists($this->archiveDir)) { mkdir($this->archiveDir, 0777, true); } if (!file_exists($this->errorDir)) { mkdir($this->errorDir, 0777, true); } if (!file_exists($this->dupDir)) { mkdir($this->dupDir, 0777, true); } if (!file_exists($this->importDir)) { mkdir($this->importDir, 0777, true); } $CCRunner = new CConsoleCommandRunner(); // test needs to make sure all new files that come in look like new // file names (unique, based on time), otherwise there will be errors: foreach (glob($this->originalImportDir . '/*.fmes') as $file) { $this->prepareFile($file); } $this->legacyFieldCommand = new ImportLegacyVFCommand('LegacyFields', $CCRunner); }
protected function setUp() { $firstProduct = new Product(); $firstProduct->name = "wooden chair 2x"; $firstProduct->description = "a wooden chair made of wood"; $firstProduct->quantity = 50; $firstProduct->price = 3000; $firstProduct->sku = uniqid(); if (!$firstProduct->save()) { throw new Exception(CHtml::errorSummary($firstProduct)); } else { $this->productModels[] = $firstProduct; } $secondProduct = new Product(); $secondProduct->name = "wooden chair 3x"; $secondProduct->description = "a wooden chair made of wood but with color"; $secondProduct->quantity = 60; $secondProduct->price = 4000; $secondProduct->sku = uniqid(); if (!$secondProduct->save()) { throw new Exception(CHtml::errorSummary($secondProduct)); } else { $this->productModels[] = $secondProduct; } /*create product model*/ parent::setUp(); }
protected function setUp() { parent::setUp(); foreach ($this->fixtures as $key => $value) { Yii::app()->db->getSchema()->resetSequence(Yii::app()->db->getSchema()->getTable($key)); } }
protected function setUp() { parent::setUp(); Yii::app()->cache->flush(); RuntimeCache::$data = array(); $this->becomeUser('User1'); }
protected function setUp() { parent::setUp(); fwrite(STDERR, ' setUp '); // $contact = $this->contacts('simple_contact_1'); // your code.... }
protected function setUp() { $component = Yii::createComponent(array('class' => 'application.extensions.simpleWorkflow.SWPhpWorkflowSource', 'basePath' => 'application.tests.unit.task.workflows')); Yii::app()->setComponent('swSource', $component); Task_2_Test::$task2 = null; parent::setUp(); }
public function setUp() { parent::setUp(); $this->oeMigration = new OEMigration(); $this->oeMigration->setVerbose(false); $this->fixturePath = Yii::getPathOfAlias('application.tests.fixtures'); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $this->model = new Contact(); //setup attributes to test with = contacts1 $this->model->setAttributes($this->contacts('contact1')->getAttributes()); }
public function setUp() { parent::setUp(); $this->orig_svcman = Yii::app()->service; $this->svcman = new ServiceManagerWrapper(); Yii::app()->setComponent('service', $this->svcman); $this->api = Yii::app()->moduleAPI->get('PatientTicketing'); }
public function setUp() { parent::setUp(); $module = new BaseEventTypeModule('OphTrOperationbooking', null); $this->controller = $this->getMockBuilder('_WrapperBookingController')->setConstructorArgs(array('_WrapperBookingController', $module))->setMethods(array('redirect', 'processJsVars'))->getMock(); $this->audit = $this->getMockBuilder('Audit')->disableOriginalConstructor()->getMock(); Yii::app()->session['selected_firm_id'] = 1; $this->controller->firm = Firm::model()->findByPk(1); }
protected function setUp() { parent::setUp(); //return; Yii::app()->db->createCommand("TRUNCATE `contactattr`")->query(); Yii::app()->db->createCommand("INSERT INTO `contactattr`(`entity`, `attribute`, `value`) VALUES ('1', 'phone', '+373 1');")->query(); Yii::app()->db->createCommand("INSERT INTO `contactattr`(`entity`, `attribute`, `value`) VALUES ('1', 'phone', '+373 2');")->query(); Yii::app()->db->createCommand("INSERT INTO `contactattr`(`entity`, `attribute`, `value`) VALUES ('1', 'skype', 'SlavaSkype');")->query(); Yii::app()->db->createCommand("INSERT INTO `contactattr`(`entity`, `attribute`, `value`) VALUES ('2', 'skype', 'AlexandrSkype');")->query(); }
function setup() { parent::setUp(); $_POST['Photo']['album_id'] = 1; $_POST['Photo']['filename'] = "IMG_1234.jpg"; $_POST['Photo']['caption'] = "This is a photo caption"; $_POST['Photo']['alt_text'] = "This is some alt text"; $_POST['Photo']['tags'] = "Tag1,Tag2,Tag3"; $_POST['Photo']['sort_order'] = 1; }
public function setUp() { parent::setUp(); $dirName = Yii::app()->getBasePath() . "/data/debugInfo/CrashRptd.pdb/6dbf5b63-6c53-4cc1-a9c4-5a97a7c66cad"; @mkdir($dirName, 0777, true); $fileName = $dirName . "/CrashRptd.pdb"; $this->_fileName = $fileName; $f = @fopen($fileName, 'w'); fwrite($f, 'MZP1234567'); fclose($f); }
public function setUp() { parent::setUp(); $dirName = Yii::app()->getBasePath() . "/data/bugAttachments/123/456"; @mkdir($dirName, 0777, true); $fileName = $dirName . "/12345678901234567890123456789012"; $this->_fileName = $fileName; $fd = fopen($fileName, 'w'); fwrite($fd, '12345'); fclose($fd); }
protected function setUp() { parent::setUp(); Topico::model()->deleteAll(); $this->usuario = new Usuario(); $this->usuario->setAttributes(['pnome' => 'Fulano', 'snome' => 'De Tal', 'email' => '*****@*****.**', 'senha' => '123456', 'senha_confirma' => '123456', 'dt_criacao' => date('Y-m-d H:i:s'), 'situacao' => Usuario::SIT_ATIVO], false); $this->usuario->save(false); $this->materia = new Materia(); $this->materia->setAttributes(['usuario_id' => $this->usuario->id, 'titulo' => 'Matéria de Teste para Cadastrar Tópico', 'dt_criacao' => date('Y-m-d H:i:s')], false); $this->materia->save(false); }
public function setUp() { parent::setUp(); $dirName = Yii::app()->getBasePath() . "/data/crashReports/4c6/d99"; if (!is_dir($dirName)) { mkdir($dirName, 0777, true); } $fileName = $dirName . "/4c6d99d7cd11906e7e9b146f3bb668ad.zip"; $this->_fileName = $fileName; $f = copy(__DIR__ . '/../../fixtures/files/4c6d99d7cd11906e7e9b146f3bb668ad.zip', $fileName); }
protected function setUp() { parent::setUp(); Materia::model()->deleteAll(); $this->usuario1 = new Usuario(); $this->usuario1->setAttributes(['pnome' => 'Fulano', 'snome' => 'De Tal', 'email' => '*****@*****.**', 'senha' => '123456', 'senha_confirma' => '123456', 'dt_criacao' => date('Y-m-d H:i:s'), 'situacao' => Usuario::SIT_ATIVO], false); $this->usuario1->save(false); $this->usuario2 = new Usuario(); $this->usuario2->setAttributes(['pnome' => 'Ciclano', 'snome' => 'De Tal', 'email' => '*****@*****.**', 'senha' => '123456', 'senha_confirma' => '123456', 'dt_criacao' => date('Y-m-d H:i:s'), 'situacao' => Usuario::SIT_ATIVO], false); $this->usuario2->save(false); }
public function setUp() { parent::setUp(); $this->orig_modules = Yii::app()->getModules(); Yii::app()->setModules(array('TestModule' => array('class' => 'ModuleAPITestNS\\TestModule'))); Yii::setPathOfAlias('ModuleAPITestNS', __DIR__ . '/ModuleAPITest'); Yii::setPathOfAlias('application.modules.TestModule.components', __DIR__ . '/ModuleAPITest/components'); // create temporary event type for testing $event_type = new EventType(); $event_type->name = 'Test Module'; $event_type->class_name = 'TestModule'; $event_type->event_group_id = 1; $event_type->noVersion()->save(); $this->test_event_type = $event_type; }
public function setUp() { // if loadFixturesForClassOnly was true, reenable fixture loading since we've already // skipped the loading of the fixtures directory and still want to have fixtures loaded // on a per test case basis if (self::$loadFixturesForClassOnly) { $this->getFixtureManager()->loadFixtures = true; } if (static::$skipAllTests) { $this->markTestSkipped(); } $fixtures = is_array($this->fixtures) ? $this->fixtures : array(); $this->fixtures = array_merge($fixtures, static::referenceFixtures()); parent::setUp(); }
public function setUp() { parent::setUp(); $dirName = Yii::app()->getBasePath() . "/testData/import/crashReports/WTLDemo/1.4.0.0"; if (!is_dir($dirName)) { mkdir($dirName, 0777, true); } $fileName = $dirName . "/7d3f465c-acee-4df6-a5fb-15a093452127.zip"; $f = copy(__DIR__ . '/../../fixtures/files/7d3f465c-acee-4df6-a5fb-15a093452127.zip', $fileName); $dirName = Yii::app()->getBasePath() . "/testData/import/debugInfo/WTLDemo/1.4.0.0"; if (!is_dir($dirName)) { mkdir($dirName, 0777, true); } $fileName = $dirName . "/crashcond.pdb"; $f = copy(__DIR__ . '/../../fixtures/files/crashcond.pdb', $fileName); }
protected function setUp() { $this->weeklySalesReport = new WeeklySalesReport(); /*delete all productOrders*/ ProductOrders::model()->deleteAll(); /*delete all products*/ Product::model()->deleteAll(); /*delete all orders*/ Orders::model()->deleteAll(); /*delete all customers*/ Customer::model()->deleteAll(); $firstProduct = new Product(); $firstProduct->name = "wooden chair 2x"; $firstProduct->description = "a wooden chair made of wood"; $firstProduct->quantity = 300; $firstProduct->price = 3000; $firstProduct->sku = uniqid(); if (!$firstProduct->save()) { throw new Exception(CHtml::errorSummary($firstProduct)); } $secondProduct = new Product(); $secondProduct->name = "wooden chair 3x"; $secondProduct->description = "a wooden chair made of wood but with color"; $secondProduct->quantity = 200; $secondProduct->price = 4000; $secondProduct->sku = uniqid(); if (!$secondProduct->save()) { throw new Exception(CHtml::errorSummary($secondProduct)); } $thirdProduct = new Product(); $thirdProduct->name = "Banana Chair"; $thirdProduct->description = "A chair that is shaped like a banana"; $thirdProduct->quantity = 500; $thirdProduct->price = 3000; $thirdProduct->sku = uniqid(); if (!$thirdProduct->save()) { throw new Exception(CHtml::errorSummary($thirdProduct)); } parent::setUp(); }
/** * * @see test/CDbTestCase::setUp() */ protected function setUp() { parent::setUp(); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $this->model = new ContactLocation(); $this->expectedLetterAddress = array('Moorfields at City Road', 'flat 1', 'bleakley creek', 'flitchley', 'london', 'ec1v 0dx'); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $this->object = new EventType(); }
function setUp($table = 'Tag') { parent::setUp(); Yii::app()->db->createCommand("truncate {$table}")->query(); Yii::app()->db->createCommand("truncate Post{$table}")->query(); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $this->model = new \OEModule\OphCiExamination\models\OphCiExamination_BlebAssessment_Vascularity(); }