27global $conf, $user, $langs, $db;
31require_once dirname(__FILE__).
'/../../htdocs/master.inc.php';
32require_once dirname(__FILE__).
'/../../htdocs/mymodule/class/myobject.class.php';
34if (empty($user->id)) {
35 print
"Load permissions for admin user nb 1\n";
39$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
66 parent::__construct($name);
69 global $conf, $user, $langs, $db;
70 $this->savconf = $conf;
71 $this->savuser = $user;
72 $this->savlangs = $langs;
75 print __METHOD__.
" db->type=".$db->type.
" user->id=".$user->id;
87 global $conf, $user, $langs, $db;
90 print __METHOD__.
"\n";
98 protected function setUp(): void
100 global $conf, $user, $langs, $db;
101 $conf = $this->savconf;
102 $user = $this->savuser;
103 $langs = $this->savlangs;
106 print __METHOD__.
"\n";
116 print __METHOD__.
"\n";
126 global $conf, $user, $langs, $db;
129 print __METHOD__.
"\n";
140 global $conf, $user, $langs, $db;
141 $conf = $this->savconf;
142 $user = $this->savuser;
143 $langs = $this->savlangs;
148 print __METHOD__.
" result=".$result.
"\n";
149 $this->assertTrue($result);
161 global $conf, $user, $langs, $db;
162 $conf = $this->savconf;
163 $user = $this->savuser;
164 $langs = $this->savlangs;
167 $localobject =
new MyObject($this->savdb);
168 $localobject->initAsSpecimen();
169 $result = $localobject->create($user);
171 print __METHOD__.
" result=".$result.
"\n";
172 $this->assertLessThan($result, 0);
188 global $conf, $user, $langs, $db;
189 $conf = $this->savconf;
190 $user = $this->savuser;
191 $langs = $this->savlangs;
194 $localobject =
new MyObject($this->savdb);
195 $result = $localobject->fetch($id);
196 $result = $localobject->delete($user);
198 print __METHOD__.
" id=".$id.
" result=".$result.
"\n";
199 $this->assertLessThan($result, 0);
__construct($name='')
Constructor We save global variables into local variables.
testMyObjectCreate()
testMyObjectCreate
static tearDownAfterClass()
Global test teardown.
static setUpBeforeClass()
Global test setup.
testMyObjectDelete($id)
testMyObjectDelete
tearDown()
Unit test teardown.
testSomething()
A sample test.