14 const TEST_DIR =
"/tmp/phpunit-actionTest-dir";
23 "testPurge" =>
"actions-purgeable.yml",
24 "testGet_action" =>
"actions-purgeable.yml",
25 "testGet_old" =>
"actions-purgeable.yml",
26 "testFinish" =>
"actions-purgeable.yml",
27 "testReset_job" =>
"actions-began.yml",
28 "testGet_job" =>
"actions-ready.yml",
29 "testCancel" =>
"actions-purgeable.yml",
30 "default" =>
"actions-purgeable.yml"
33 $dataset_file =
$list[$this->getName()];
35 $dataset_file =
"actions-empty.yml";
54 global $L_INOTIFY_DO_ACTION;
57 if (is_file($L_INOTIFY_DO_ACTION)) {
58 unlink($L_INOTIFY_DO_ACTION);
66 global $L_INOTIFY_DO_ACTION;
67 $result = $this->
object->do_action();
68 $this->assertTrue($result);
69 $this->assertFileExists($L_INOTIFY_DO_ACTION);
76 $result = $this->
object->create_file(self::TEST_FILE,
"phpunit");
77 $this->assertTrue($result);
78 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
85 $result = $this->
object->create_dir(self::TEST_FILE);
86 $this->assertTrue($result);
87 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
94 $result = $this->
object->fix_user(self::TEST_UID);
95 $this->assertTrue($result);
96 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
103 $result = $this->
object->fix_dir(self::TEST_DIR);
104 $this->assertTrue($result);
105 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
112 $result = $this->
object->fix_file(self::TEST_FILE);
113 $this->assertTrue($result);
114 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
121 $result = $this->
object->del(self::TEST_DIR);
122 $this->assertTrue($result);
123 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
130 $result = $this->
object->move(self::TEST_FILE, self::TEST_DIR);
131 $this->assertTrue($result);
132 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
139 $result = $this->
object->archive(self::TEST_DIR);
140 $this->assertTrue($result);
141 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
149 $result = $this->
object->set(null, null, null);
150 $this->assertFalse($result);
151 $this->assertEquals(0, $this->
getConnection()->getRowCount(
'actions'));
158 $result = $this->
object->get_old();
159 $this->assertEquals(1, $result);
166 $result = $this->
object->purge();
167 $this->assertEquals(0, $result);
168 $expectedTable = $this->
loadDataSet(
"actions-empty.yml")->getTable(
"actions");
169 $currentTable = $this->
getConnection()->createQueryTable(
'actions',
'SELECT * FROM actions');
170 $this->assertTablesEqual($expectedTable, $currentTable);
177 $result = $this->
object->get_action();
178 $this->assertTrue(is_array($result));
179 $this->assertCount(1, $result);
180 return current($result);
188 $result = $this->
object->begin($action[
"id"]);
189 $this->assertTrue($result);
197 $result = $this->
object->finish($action[
"id"]);
198 $this->assertTrue($result);
200 'actions',
'SELECT * FROM actions WHERE DAY(end) = DAY(NOW())'
202 $row_count = $queryTable->getRowCount();
203 $this->assertEquals(1, $row_count);
211 $result = $this->
object->reset_job($action[
"id"]);
212 $this->assertTrue($result);
214 'actions',
'SELECT * FROM actions WHERE end = 0 AND begin = 0 AND status = 0'
216 $this->assertEquals(1, $queryTable->getRowCount());
225 $result = $this->
object->get_job();
226 $this->assertTrue(is_array($result));
227 $this->assertCount(1, $result);
235 $result = $this->
object->cancel($variable[
"id"]);
236 $this->assertTrue($result);
238 'actions',
'SELECT * FROM actions WHERE DAY(end) = DAY(NOW())'
240 $row_count = $queryTable->getRowCount();
241 $this->assertEquals(1, $row_count);