Пример #1
0
 /**
  * test
  */
 public function getTest()
 {
     $url = 'https://testkrok.org.ua/?test=734';
     $session = 'S=llj70qc6rcnc7r6c98cq289bq0';
     $array_posts = array('answer' => 'c', 'mix' => 'MTU1', 'question_an' => 'OTIwMGFIYWhhIQ==', 'question_id' => '42536');
     $test_obj_arr = [];
     $test_html = $this->parser->getTest($url, $session);
     $test_obj_arr[] = $this->parser->createTestObj($test_html['body']);
     for ($i = 1; $i <= 3; $i++) {
         $test_html = $this->parser->getTest($url, $session, $array_posts);
         $test_obj_arr[] = $this->parser->createTestObj($test_html['body']);
     }
     $importer = new TestImporter();
     $xml = $importer->import_arr($test_obj_arr);
     print_r($xml);
     $this->assertFalse(strpos($test_html['body'], 'Сеанс роботи був завершений через неактивність'));
 }
 /**
  * @test
  */
 public function import_arr()
 {
     $test = new Test();
     $test->setAsk('Ask test');
     $variant_1 = new Variant();
     $variant_1->setVariant('Variant1');
     $variant_1->setPrOtvet(true);
     $test->addVariant($variant_1);
     $variant_2 = new Variant();
     $variant_2->setVariant('Variant2');
     $variant_2->setPrOtvet(true);
     $test->addVariant($variant_2);
     $variant_3 = new Variant();
     $variant_3->setVariant('Variant3');
     $variant_3->setPrOtvet(false);
     $test->addVariant($variant_3);
     $arr = [$test, $test];
     $test_xml = new TestImporter();
     $xml = $test_xml->import_arr($arr);
     //print_r($xml);
 }