当前位置: 首页>>代码示例>>PHP>>正文


PHP Test::create方法代码示例

本文整理汇总了PHP中Test::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Test::create方法的具体用法?PHP Test::create怎么用?PHP Test::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Test的用法示例。


在下文中一共展示了Test::create方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_sti_field_is_saved_and_used_correctly

 function test_sti_field_is_saved_and_used_correctly()
 {
     setup_sqlite_test_db();
     # Create a dummy test entries
     $dummy = Test::create(array("dummy" => "TestDummy"));
     $this->assertEqual($dummy->type, NULL);
     $stest = new SuperTest(array("dummy" => "SuperDummy"));
     $stest->save();
     $this->assertEqual(strtolower($stest->type), "supertest");
     $utest = new UltraTest(array("dummy" => "UltraDummy"));
     $utest->save();
     $this->assertEqual(strtolower($utest->type), "ultratest");
     $atest = new AutoTest(array("dummy" => "AutoDummy"));
     $atest->save();
     $this->assertEqual(strtolower($atest->type), "autotest");
     # PHP 5.3 needed to call magic methods statically, so
     # work around by instanciating the class as singleton
     $Test = Singleton::instance("Test");
     # Load and check test entries
     $dummy2 = $Test->find_by_dummy("TestDummy");
     $this->assertEqual($dummy2->type, NULL);
     $this->assertEqual(strtolower(get_class($dummy2)), "test");
     $stest2 = $Test->find_by_dummy("SuperDummy");
     $this->assertEqual(strtolower($stest2->type), "supertest");
     $this->assertEqual(strtolower(get_class($stest2)), "supertest");
     $utest2 = $Test->find_by_dummy("UltraDummy");
     $this->assertEqual(strtolower($utest2->type), "ultratest");
     $this->assertEqual(strtolower(get_class($utest2)), "ultratest");
     $atest2 = $Test->find_by_dummy("AutoDummy");
     $this->assertEqual(strtolower($atest2->type), "autotest");
     $this->assertEqual(strtolower(get_class($atest2)), "autotest");
 }
开发者ID:kakra,项目名称:adodbrecord,代码行数:32,代码来源:TestSTI.class.php

示例2: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Test::create([]);
     }
 }
开发者ID:jarciga,项目名称:Euler2015Alpha,代码行数:7,代码来源:TestsTableSeeder.php

示例3: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Test::create(['name' => $faker->word, 'category_id' => $faker->randomNumber(1, 5)]);
     }
 }
开发者ID:SenhorBardell,项目名称:wordotheday,代码行数:7,代码来源:TestsTableSeeder.php

示例4: test_find_by

 function test_find_by()
 {
     setup_sqlite_test_db();
     # PHP 5.3 needed to call magic methods statically, so
     # work around by instanciating the class as singleton
     $Test = Singleton::instance("Test");
     # create two test entries to be found
     Test::create(array("dummy" => "Test 1"), array("dummy" => "Test 2"));
     # Test find_by single id
     $dummy = $Test->find_by_id(1);
     $this->assertEqual(strtolower(get_class($dummy)), "test");
     $this->assertEqual($dummy->dummy, "Test 1");
     # Test find_by id array
     $dummies = $Test->find_by_id(array(1, 2), array("order" => "id"));
     $this->assertEqual(count($dummies), 2);
     $this->assertEqual($dummies[0]->dummy, "Test 1");
     $this->assertEqual($dummies[1]->dummy, "Test 2");
     # Test it works with strings, too
     $dummy = $Test->find_by_dummy("Test 2");
     $this->assertEqual($dummy->id, 2);
     # Test their combination
     $dummy = $Test->find_by_id_and_dummy(1, "Test 1");
     $this->assertEqual($dummy->id, 1);
     $this->assertEqual($dummies[0]->dummy, "Test 1");
     # Test their array'ed combination
     $dummies = $Test->find_by_id_and_dummy(array(1, 2), array("Test 1", "Test 2"), array("order" => "id"));
     $this->assertEqual(count($dummies), 2);
     $this->assertEqual($dummies[0]->dummy, "Test 1");
     $this->assertEqual($dummies[1]->dummy, "Test 2");
 }
开发者ID:kakra,项目名称:adodbrecord,代码行数:30,代码来源:TestMagicFinders.class.php

示例5: test_insert_into_database

 public function test_insert_into_database()
 {
     $data = ['test1' => 'test1', 'test2' => 'test2', 'test3' => 'test3'];
     $test = Test::create($data);
     // $result = $test->toArray();
     $this->assertEquals($test->id, 1);
     $this->assertEquals($test->test1, $data['test1']);
     $this->assertEquals($test->test2, $data['test2']);
     $this->assertEquals($test->test3, $data['test3']);
 }
开发者ID:recca0120,项目名称:package-phpunit,代码行数:10,代码来源:DatabaseTest.php

示例6: test_find_all_returns_array

 function test_find_all_returns_array()
 {
     # create two test entries to be found
     Test::create(array("dummy" => "Test 1"), array("dummy" => "Test 2"));
     $result = Test::find_all(array("conditions" => "id = 1"));
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 1);
     $result = Test::find("all", array("conditions" => array("id = ?", 2)));
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 1);
 }
开发者ID:kakra,项目名称:adodbrecord,代码行数:11,代码来源:TestFindConditions.class.php

示例7: store

 /**
  * Store a newly created resource in storage.
  * POST /tests
  *
  * @return Response
  */
 public function store($id)
 {
     $visit = $this->getVisit($id);
     if (is_null($visit)) {
         return Redirect::route('patient-chart-get', $id)->with('global', 'No visit found, kindly start a new visit for this patient to proceed!');
     }
     $validator = Validator::make($data = Input::all(), Test::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['patient_id'] = $id;
     $data['visit_id'] = $visit->id;
     Test::create($data);
     return Redirect::route('patient-chart-get', $id)->with('global', 'New test created.');
 }
开发者ID:joelmwas,项目名称:bimareport,代码行数:21,代码来源:TestsController.php

示例8: test_create

 function test_create()
 {
     setup_sqlite_test_db();
     # Create a dummy test entry, ensure it is of correct type and got its
     # parameters correctly saved
     $dummy = Test::create(array("dummy" => "Test456"));
     $this->assertEqual(strtolower(get_class($dummy)), "test");
     $this->assertEqual($dummy->_base_class, "Test");
     $this->assertEqual($dummy->dummy, "Test456");
     $this->assertTrue($dummy->id > 0);
     # Now create two test entries at once
     $dummys = Test::create(array("dummy" => "Test567"), array("dummy" => "Test678"));
     $this->assertEqual(count($dummys), 2);
     # Return the complete table and check there is exactly one row
     $all_rows = Test::find("all");
     $this->assertEqual(count($all_rows), 3);
     # Return the first row and check it still matches our first dummy test entry
     $first = Test::find("first");
     $this->assertEqual($first->dummy, "Test456");
     $this->assertTrue($first->id > 0);
 }
开发者ID:kakra,项目名称:adodbrecord,代码行数:21,代码来源:TestTableStorage.class.php

示例9: testCreation

 /**
  * testCreation method
  *
  * @return void
  */
 public function testCreation()
 {
     $this->loadFixtures('Article', 'ArticleFeaturedsTags', 'User', 'Featured');
     $TestModel = new Test();
     $result = $TestModel->create();
     $expected = array('Test' => array('notes' => 'write some notes here'));
     $this->assertEquals($expected, $result);
     $TestModel = new User();
     $result = $TestModel->schema();
     if (isset($this->db->columns['primary_key']['length'])) {
         $intLength = $this->db->columns['primary_key']['length'];
     } elseif (isset($this->db->columns['integer']['length'])) {
         $intLength = $this->db->columns['integer']['length'];
     } else {
         $intLength = 11;
     }
     foreach (array('collate', 'charset', 'comment', 'unsigned') as $type) {
         foreach ($result as $i => $r) {
             unset($result[$i][$type]);
         }
     }
     $expected = array('id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => $intLength, 'key' => 'primary'), 'user' => array('type' => 'string', 'null' => true, 'default' => '', 'length' => 255), 'password' => array('type' => 'string', 'null' => true, 'default' => '', 'length' => 255), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'length' => null), 'updated' => array('type' => 'datetime', 'null' => true, 'default' => null, 'length' => null));
     $this->assertEquals($expected, $result);
     $TestModel = new Article();
     $result = $TestModel->create();
     $expected = array('Article' => array('published' => 'N'));
     $this->assertEquals($expected, $result);
     $FeaturedModel = new Featured();
     $data = array('article_featured_id' => 1, 'category_id' => 1, 'published_date' => array('year' => 2008, 'month' => 06, 'day' => 11), 'end_date' => array('year' => 2008, 'month' => 06, 'day' => 20));
     $expected = array('Featured' => array('article_featured_id' => 1, 'category_id' => 1, 'published_date' => '2008-06-11 00:00:00', 'end_date' => '2008-06-20 00:00:00'));
     $this->assertEquals($expected, $FeaturedModel->create($data));
     $data = array('published_date' => array('year' => 2008, 'month' => 06, 'day' => 11), 'end_date' => array('year' => 2008, 'month' => 06, 'day' => 20), 'article_featured_id' => 1, 'category_id' => 1);
     $expected = array('Featured' => array('published_date' => '2008-06-11 00:00:00', 'end_date' => '2008-06-20 00:00:00', 'article_featured_id' => 1, 'category_id' => 1));
     $this->assertEquals($expected, $FeaturedModel->create($data));
 }
开发者ID:agashish,项目名称:test_new,代码行数:40,代码来源:ModelIntegrationTest.php

示例10: run

 public function run()
 {
     /* Users table */
     $usersData = array(array("username" => "administrator", "password" => Hash::make("password"), "email" => "admin@kblis.org", "name" => "kBLIS Administrator", "designation" => "Programmer"), array("username" => "external", "password" => Hash::make("password"), "email" => "admin@kblis.org", "name" => "External System User", "designation" => "Administrator", "image" => "/i/users/user-2.jpg"), array("username" => "lmorena", "password" => Hash::make("password"), "email" => "lmorena@kblis.org", "name" => "L. Morena", "designation" => "Lab Technologist", "image" => "/i/users/user-3.png"), array("username" => "abumeyang", "password" => Hash::make("password"), "email" => "abumeyang@kblis.org", "name" => "A. Abumeyang", "designation" => "Doctor"));
     foreach ($usersData as $user) {
         $users[] = User::create($user);
     }
     $this->command->info('users seeded');
     /* Specimen Types table */
     $specTypesData = array(array("name" => "Ascitic Tap"), array("name" => "Aspirate"), array("name" => "CSF"), array("name" => "Dried Blood Spot"), array("name" => "High Vaginal Swab"), array("name" => "Nasal Swab"), array("name" => "Plasma"), array("name" => "Plasma EDTA"), array("name" => "Pleural Tap"), array("name" => "Pus Swab"), array("name" => "Rectal Swab"), array("name" => "Semen"), array("name" => "Serum"), array("name" => "Skin"), array("name" => "Sputum"), array("name" => "Stool"), array("name" => "Synovial Fluid"), array("name" => "Throat Swab"), array("name" => "Urethral Smear"), array("name" => "Urine"), array("name" => "Vaginal Smear"), array("name" => "Water"), array("name" => "Whole Blood"));
     foreach ($specTypesData as $specimenType) {
         $specTypes[] = SpecimenType::create($specimenType);
     }
     $this->command->info('specimen_types seeded');
     /* Test Categories table - These map on to the lab sections */
     $test_categories = TestCategory::create(array("name" => "PARASITOLOGY", "description" => ""));
     $lab_section_microbiology = TestCategory::create(array("name" => "MICROBIOLOGY", "description" => ""));
     $this->command->info('test_categories seeded');
     /* Measure Types */
     $measureTypes = array(array("id" => "1", "name" => "Numeric Range"), array("id" => "2", "name" => "Alphanumeric Values"), array("id" => "3", "name" => "Autocomplete"), array("id" => "4", "name" => "Free Text"));
     foreach ($measureTypes as $measureType) {
         MeasureType::create($measureType);
     }
     $this->command->info('measure_types seeded');
     /* Measures table */
     $measureBSforMPS = Measure::create(array("measure_type_id" => "2", "name" => "BS for mps", "unit" => ""));
     $measure1 = Measure::create(array("measure_type_id" => "2", "name" => "Grams stain", "unit" => ""));
     $measure2 = Measure::create(array("measure_type_id" => "2", "name" => "SERUM AMYLASE", "unit" => ""));
     $measure3 = Measure::create(array("measure_type_id" => "2", "name" => "calcium", "unit" => ""));
     $measure4 = Measure::create(array("measure_type_id" => "2", "name" => "SGOT", "unit" => ""));
     $measure5 = Measure::create(array("measure_type_id" => "2", "name" => "Indirect COOMBS test", "unit" => ""));
     $measure6 = Measure::create(array("measure_type_id" => "2", "name" => "Direct COOMBS test", "unit" => ""));
     $measure7 = Measure::create(array("measure_type_id" => "2", "name" => "Du test", "unit" => ""));
     MeasureRange::create(array("measure_id" => $measureBSforMPS->id, "alphanumeric" => "No mps seen", "interpretation" => "Negative"));
     MeasureRange::create(array("measure_id" => $measureBSforMPS->id, "alphanumeric" => "+", "interpretation" => "Positive"));
     MeasureRange::create(array("measure_id" => $measureBSforMPS->id, "alphanumeric" => "++", "interpretation" => "Positive"));
     MeasureRange::create(array("measure_id" => $measureBSforMPS->id, "alphanumeric" => "+++", "interpretation" => "Positive"));
     MeasureRange::create(array("measure_id" => $measure1->id, "alphanumeric" => "Negative"));
     MeasureRange::create(array("measure_id" => $measure1->id, "alphanumeric" => "Positive"));
     MeasureRange::create(array("measure_id" => $measure2->id, "alphanumeric" => "Low"));
     MeasureRange::create(array("measure_id" => $measure2->id, "alphanumeric" => "High"));
     MeasureRange::create(array("measure_id" => $measure2->id, "alphanumeric" => "Normal"));
     MeasureRange::create(array("measure_id" => $measure3->id, "alphanumeric" => "High"));
     MeasureRange::create(array("measure_id" => $measure3->id, "alphanumeric" => "Low"));
     MeasureRange::create(array("measure_id" => $measure3->id, "alphanumeric" => "Normal"));
     MeasureRange::create(array("measure_id" => $measure4->id, "alphanumeric" => "High"));
     MeasureRange::create(array("measure_id" => $measure4->id, "alphanumeric" => "Low"));
     MeasureRange::create(array("measure_id" => $measure4->id, "alphanumeric" => "Normal"));
     MeasureRange::create(array("measure_id" => $measure5->id, "alphanumeric" => "Positive"));
     MeasureRange::create(array("measure_id" => $measure5->id, "alphanumeric" => "Negative"));
     MeasureRange::create(array("measure_id" => $measure6->id, "alphanumeric" => "Positive"));
     MeasureRange::create(array("measure_id" => $measure6->id, "alphanumeric" => "Negative"));
     MeasureRange::create(array("measure_id" => $measure7->id, "alphanumeric" => "Positive"));
     MeasureRange::create(array("measure_id" => $measure7->id, "alphanumeric" => "Negative"));
     $measures = array(array("measure_type_id" => "1", "name" => "URIC ACID", "unit" => "mg/dl"), array("measure_type_id" => "4", "name" => "CSF for biochemistry", "unit" => ""), array("measure_type_id" => "4", "name" => "PSA", "unit" => ""), array("measure_type_id" => "1", "name" => "Total", "unit" => "mg/dl"), array("measure_type_id" => "1", "name" => "Alkaline Phosphate", "unit" => "u/l"), array("measure_type_id" => "1", "name" => "Direct", "unit" => "mg/dl"), array("measure_type_id" => "1", "name" => "Total Proteins", "unit" => ""), array("measure_type_id" => "4", "name" => "LFTS", "unit" => "NULL"), array("measure_type_id" => "1", "name" => "Chloride", "unit" => "mmol/l"), array("measure_type_id" => "1", "name" => "Potassium", "unit" => "mmol/l"), array("measure_type_id" => "1", "name" => "Sodium", "unit" => "mmol/l"), array("measure_type_id" => "4", "name" => "Electrolytes", "unit" => ""), array("measure_type_id" => "1", "name" => "Creatinine", "unit" => "mg/dl"), array("measure_type_id" => "1", "name" => "Urea", "unit" => "mg/dl"), array("measure_type_id" => "4", "name" => "RFTS", "unit" => ""), array("measure_type_id" => "4", "name" => "TFT", "unit" => ""));
     foreach ($measures as $measure) {
         Measure::create($measure);
     }
     $measureGXM = Measure::create(array("measure_type_id" => "4", "name" => "GXM", "unit" => ""));
     $measureBG = Measure::create(array("measure_type_id" => "2", "name" => "Blood Grouping", "unit" => ""));
     MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "O-"));
     MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "O+"));
     MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "A-"));
     MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "A+"));
     MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "B-"));
     MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "B+"));
     MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "AB-"));
     MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "AB+"));
     $measureHB = Measure::create(array("measure_type_id" => Measure::NUMERIC, "name" => "HB", "unit" => "g/dL"));
     $measuresUrinalysisData = array(array("measure_type_id" => "4", "name" => "Urine microscopy", "unit" => ""), array("measure_type_id" => "4", "name" => "Pus cells", "unit" => ""), array("measure_type_id" => "4", "name" => "S. haematobium", "unit" => ""), array("measure_type_id" => "4", "name" => "T. vaginalis", "unit" => ""), array("measure_type_id" => "4", "name" => "Yeast cells", "unit" => ""), array("measure_type_id" => "4", "name" => "Red blood cells", "unit" => ""), array("measure_type_id" => "4", "name" => "Bacteria", "unit" => ""), array("measure_type_id" => "4", "name" => "Spermatozoa", "unit" => ""), array("measure_type_id" => "4", "name" => "Epithelial cells", "unit" => ""), array("measure_type_id" => "4", "name" => "ph", "unit" => ""), array("measure_type_id" => "4", "name" => "Urine chemistry", "unit" => ""), array("measure_type_id" => "4", "name" => "Glucose", "unit" => ""), array("measure_type_id" => "4", "name" => "Ketones", "unit" => ""), array("measure_type_id" => "4", "name" => "Proteins", "unit" => ""), array("measure_type_id" => "4", "name" => "Blood", "unit" => ""), array("measure_type_id" => "4", "name" => "Bilirubin", "unit" => ""), array("measure_type_id" => "4", "name" => "Urobilinogen Phenlpyruvic acid", "unit" => ""), array("measure_type_id" => "4", "name" => "pH", "unit" => ""));
     foreach ($measuresUrinalysisData as $measureU) {
         $measuresUrinalysis[] = Measure::create($measureU);
     }
     $measuresWBCData = array(array("measure_type_id" => Measure::NUMERIC, "name" => "WBC", "unit" => "x10³/µL"), array("measure_type_id" => Measure::NUMERIC, "name" => "Lym", "unit" => "L"), array("measure_type_id" => Measure::NUMERIC, "name" => "Mon", "unit" => "*"), array("measure_type_id" => Measure::NUMERIC, "name" => "Neu", "unit" => "*"), array("measure_type_id" => Measure::NUMERIC, "name" => "Eos", "unit" => ""), array("measure_type_id" => Measure::NUMERIC, "name" => "Baso", "unit" => ""));
     foreach ($measuresWBCData as $value) {
         $measuresWBC[] = Measure::create($value);
     }
     $measureRangesWBC = array(array("measure_id" => $measuresWBC[0]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 4, "range_upper" => 11), array("measure_id" => $measuresWBC[1]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 1.5, "range_upper" => 4), array("measure_id" => $measuresWBC[2]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 0.1, "range_upper" => 9), array("measure_id" => $measuresWBC[3]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 2.5, "range_upper" => 7), array("measure_id" => $measuresWBC[4]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 0, "range_upper" => 6), array("measure_id" => $measuresWBC[5]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 0, "range_upper" => 2));
     foreach ($measureRangesWBC as $value) {
         MeasureRange::create($value);
     }
     $this->command->info('measures seeded');
     /* Test Types table */
     $testTypeBS = TestType::create(array("name" => "BS for mps", "test_category_id" => $test_categories->id, "orderable_test" => 1));
     $testTypeStoolCS = TestType::create(array("name" => "Stool for C/S", "test_category_id" => $lab_section_microbiology->id));
     $testTypeGXM = TestType::create(array("name" => "GXM", "test_category_id" => $test_categories->id));
     $testTypeHB = TestType::create(array("name" => "HB", "test_category_id" => $test_categories->id, "orderable_test" => 1));
     $testTypeUrinalysis = TestType::create(array("name" => "Urinalysis", "test_category_id" => $test_categories->id));
     $testTypeWBC = TestType::create(array("name" => "WBC", "test_category_id" => $test_categories->id));
     $this->command->info('test_types seeded');
     /* TestType Measure table */
     TestTypeMeasure::create(array("test_type_id" => $testTypeBS->id, "measure_id" => $measureBSforMPS->id));
     TestTypeMeasure::create(array("test_type_id" => $testTypeGXM->id, "measure_id" => $measureGXM->id));
     TestTypeMeasure::create(array("test_type_id" => $testTypeGXM->id, "measure_id" => $measureBG->id));
     TestTypeMeasure::create(array("test_type_id" => $testTypeHB->id, "measure_id" => $measureHB->id));
     foreach ($measuresUrinalysis as $value) {
         TestTypeMeasure::create(array("test_type_id" => $testTypeUrinalysis->id, "measure_id" => $value->id));
     }
     foreach ($measuresWBC as $value) {
         TestTypeMeasure::create(array("test_type_id" => $testTypeWBC->id, "measure_id" => $value->id));
//.........这里部分代码省略.........
开发者ID:BaobabHealthTrust,项目名称:iBLIS,代码行数:101,代码来源:TestDataSeeder.php

示例11: run

 public function run()
 {
     /******************************************************************************
      * --- Test ---
      ******************************************************************************/
     Test::create(array('name' => 'BURNOUT', 'idTestType' => '2'));
     /******************************************************************************
      * --- Escalas ---
      ******************************************************************************/
     Scale::create(array('idTest' => '4', 'description' => 'Reducida Sensación'));
     Scale::create(array('idTest' => '4', 'description' => 'Agotamiento'));
     Scale::create(array('idTest' => '4', 'description' => 'Devaluación'));
     /******************************************************************************
      * --- Rangos Posibles ---
      ******************************************************************************/
     Range::create(array('description' => 'Bajo', 'min' => '5.0', 'max' => '11.0'));
     Range::create(array('description' => 'Medio', 'min' => '12.0', 'max' => '18.0'));
     Range::create(array('description' => 'Alto', 'min' => '19.0', 'max' => '25.0'));
     /******************************************************************************
      * --- Rangos por Escala ---
      ******************************************************************************/
     // Reducida Sensación
     ScaleRange::create(array('idScale' => '12', 'idRange' => '10'));
     ScaleRange::create(array('idScale' => '12', 'idRange' => '11'));
     ScaleRange::create(array('idScale' => '12', 'idRange' => '12'));
     // Agotamiento
     ScaleRange::create(array('idScale' => '13', 'idRange' => '10'));
     ScaleRange::create(array('idScale' => '13', 'idRange' => '11'));
     ScaleRange::create(array('idScale' => '13', 'idRange' => '12'));
     // Devaluación
     ScaleRange::create(array('idScale' => '14', 'idRange' => '10'));
     ScaleRange::create(array('idScale' => '14', 'idRange' => '11'));
     ScaleRange::create(array('idScale' => '14', 'idRange' => '12'));
     /******************************************************************************
      * --- Grupos ---
      ******************************************************************************/
     Group::create(array());
     // Burnout (orden normal) Con id = 5
     Group::create(array());
     // Burnout (orden inverso) Con id = 6
     /******************************************************************************
      * --- Posibles Respuestas ---
      ******************************************************************************/
     // --- BURNOUT (orden normal) ---
     TestAnswer::create(array('number' => '1', 'description' => 'Casi nunca', 'idGroup' => '5'));
     TestAnswer::create(array('number' => '2', 'description' => 'Pocas veces', 'idGroup' => '5'));
     TestAnswer::create(array('number' => '3', 'description' => 'Algunas veces', 'idGroup' => '5'));
     TestAnswer::create(array('number' => '4', 'description' => 'A menudo', 'idGroup' => '5'));
     TestAnswer::create(array('number' => '5', 'description' => 'Casi siempre', 'idGroup' => '5'));
     // --- BURNOUT (orden inverso) ---
     TestAnswer::create(array('number' => '5', 'description' => 'Casi nunca', 'idGroup' => '6'));
     TestAnswer::create(array('number' => '4', 'description' => 'Pocas veces', 'idGroup' => '6'));
     TestAnswer::create(array('number' => '3', 'description' => 'Algunas veces', 'idGroup' => '6'));
     TestAnswer::create(array('number' => '2', 'description' => 'A menudo', 'idGroup' => '6'));
     TestAnswer::create(array('number' => '1', 'description' => 'Casi siempre', 'idGroup' => '6'));
     /******************************************************************************
      * --- Preguntas ---
      ******************************************************************************/
     $burnout = '4';
     $reducidaSensacion = '12';
     $agotamiento = '13';
     $devaluacion = '14';
     $grupoBurnoutNormal = '5';
     $grupoBurnoutInverso = '6';
     Question::create(array('idTest' => $burnout, 'idScale' => $reducidaSensacion, 'number' => '1', 'description' => 'Siento que estoy logrando muchas cosas que valen la pena en mi deporte.', 'idGroup' => $grupoBurnoutInverso));
     Question::create(array('idTest' => $burnout, 'idScale' => $agotamiento, 'number' => '2', 'description' => 'Me siento tan cansado de mis entrenamientos que tengo problemas al encontrar energía para hacer otras cosas.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $devaluacion, 'number' => '3', 'description' => 'El esfuerzo y tiempo que dedico a mi deporte estaría mejor invertido realizando otras actividades más productivas.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $agotamiento, 'number' => '4', 'description' => 'Me siento demasiado cansado debido a mis actividades en mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $reducidaSensacion, 'number' => '5', 'description' => 'No estoy consiguiendo logros importantes en mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $devaluacion, 'number' => '6', 'description' => 'No me importa tanto mi rendimiento en mi deporte como antes.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $reducidaSensacion, 'number' => '7', 'description' => 'No estoy rindiendo de acuerdo a mi verdadera capacidad en mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $agotamiento, 'number' => '8', 'description' => 'Me siento "desgastado" física y emocionalmente por debido a mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $devaluacion, 'number' => '9', 'description' => 'No estoy tan interesado en mi deporte como acostumbraba hacerlo antes.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $agotamiento, 'number' => '10', 'description' => 'Me siento físicamente agotado por debido a mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $devaluacion, 'number' => '11', 'description' => 'Me siento menos preocupado por tener éxito en mi deporte de lo que solía hacerlo.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $agotamiento, 'number' => '12', 'description' => 'Estoy agotado por las exigencias físicas y mentales de mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $reducidaSensacion, 'number' => '13', 'description' => 'Parece que no importa lo que haga, no logro rendir tan bien como podría hacerlo.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $reducidaSensacion, 'number' => '14', 'description' => 'Me siento exitoso en mi deporte.', 'idGroup' => $grupoBurnoutInverso));
     Question::create(array('idTest' => $burnout, 'idScale' => $devaluacion, 'number' => '15', 'description' => 'Tengo sentimientos y pensamientos negativos hacia mi deporte.', 'idGroup' => $grupoBurnoutNormal));
 }
开发者ID:ebuzz,项目名称:SAPE_CAR,代码行数:80,代码来源:DatabaseSeeder.php

示例12: storeAction

 /**
  * Store new test
  *
  * @return mixed
  */
 public function storeAction()
 {
     $data = Input::all();
     $validation = Validator::make($data, Test::$rules);
     if (!$validation->passes()) {
         return Redirect::route('tests.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
     }
     if (!$data['category_id']) {
         return Redirect::route('tests.create')->withInput()->with('message', 'Укажите категорию теста.');
     }
     /**
      * Check name duplicates
      */
     if (count(Test::where('name', $data['name'])->where('version', (int) $data['version'])->get())) {
         /**
          * This test exists, generate new version
          */
         $data['version'] = $this->getNextVersion($data['name']);
     }
     $data['user_id'] = Auth::user()->getId();
     $data['active'] = false;
     $data['duration'] = $data['duration'] * 60;
     $test = Test::create($data);
     return Redirect::route('tests.show', $test->id);
 }
开发者ID:himor,项目名称:testing,代码行数:30,代码来源:TestsController.php


注:本文中的Test::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。