Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_test_dcp_DSearch.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 
7 namespace Dcp\Pu;
8 /**
9  * @author Anakeen
10  * @package Dcp\Pu
11  */
12 
13 require_once 'PU_testcase_dcp_commonfamily.php';
14 
16 {
17  static function getCommonImportFile()
18  {
19  return array(
20  'PU_data_dcp_dsearch.ods'
21  );
22  }
23  /**
24  * @dataProvider dataDSearchConstraints
25  */
26  public function testDSearchConstraints($data)
27  {
28  $this->requiresCoreParamEquals('CORE_LANG', 'fr_FR');
29 
30  $doc = new_Doc(self::$dbaccess, $data['doc']);
31  $this->assertTrue(($doc !== null && $doc->isAlive()) , sprintf("Could not find document with id '%s'.", $data['doc']));
32  $info = array();
33  $err = $doc->store($info);
34  $this->assertNotEmpty($err, "Store of document with id '%s' did not returned an expected error message.", $data['doc']);
35  foreach ($data['expect'] as $re) {
36  $match = preg_match($re, $err);
37  $this->assertTrue(($match !== false && $match > 0) , sprintf("Error message '%s' did not matched expected '%s'.", $err, $re));
38  }
39  }
40 
41  public function dataDSearchConstraints()
42  {
43  return array(
44  array(
45  array(
46  "doc" => "DSEARCH_01",
47  "expect" => array(
48  "/.* 's_text' .*: expression rationnelle invalide/u"
49  )
50  )
51  ) ,
52  array(
53  array(
54  "doc" => "DSEARCH_02",
55  "expect" => array(
56  "/.* 's_date' .*: horodatage malformé/u"
57  )
58  )
59  ) ,
60  array(
61  array(
62  "doc" => "DSEARCH_03",
63  "expect" => array(
64  "/'s_timestamp' .*: horodatage malformé/u"
65  )
66  )
67  ) ,
68  array(
69  array(
70  "doc" => "DSEARCH_04",
71  "expect" => array(
72  "/parenthèses non équilibrées/u"
73  )
74  )
75  )
76  );
77  }
78 }
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
$info
Definition: geticon.php:30
if($file) if($subject==""&&$file) if($subject=="") $err
requiresCoreParamEquals($paramName, $requiredValue, $markTestIncomplete=true)
$data
← centre documentaire © anakeen