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"
32 if (isset(
$list[$this->getName()])) {
33 $dataset_file =
$list[$this->getName()];
35 $dataset_file =
"actions-empty.yml";
37 return parent::loadDataSet($dataset_file);
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 file_put_contents(
"/tmp/log_fser",
"hello world from fser");
68 $result = $this->
object->do_action();
69 $this->assertTrue($result);
70 $this->assertFileExists($L_INOTIFY_DO_ACTION);
77 $result = $this->
object->chmod(self::TEST_FILE, 0777,
"phpunit");
78 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
86 $result = $this->
object->create_file(self::TEST_FILE,
"phpunit");
87 $this->assertTrue($result);
88 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
95 $result = $this->
object->create_dir(self::TEST_FILE);
96 $this->assertTrue($result);
97 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
104 $result = $this->
object->fix_user(self::TEST_UID);
105 $this->assertTrue($result);
106 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
113 $result = $this->
object->fix_dir(self::TEST_DIR);
114 $this->assertTrue($result);
115 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
122 $result = $this->
object->fix_file(self::TEST_FILE);
123 $this->assertTrue($result);
124 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
131 $result = $this->
object->del(self::TEST_DIR);
132 $this->assertTrue($result);
133 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
140 $result = $this->
object->move(self::TEST_FILE, self::TEST_DIR);
141 $this->assertTrue($result);
142 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
149 $result = $this->
object->archive(self::TEST_DIR);
150 $this->assertTrue($result);
151 $this->assertEquals(1, $this->
getConnection()->getRowCount(
'actions'));
159 $result = $this->
object->set(
null,
null,
null);
160 $this->assertFalse($result);
161 $this->assertEquals(0, $this->
getConnection()->getRowCount(
'actions'));
168 $result = $this->
object->get_old();
169 $this->assertEquals(1, $result);
176 $result = $this->
object->purge();
177 $this->assertEquals(1, $result);
178 $expectedTable = $this->
loadDataSet(
"actions-empty.yml")->getTable(
"actions");
179 $currentTable = $this->
getConnection()->createQueryTable(
'actions',
'SELECT * FROM actions');
180 $this->assertTablesEqual($expectedTable, $currentTable);
187 $result = $this->
object->get_action();
188 $this->assertTrue(is_array($result));
189 $this->assertCount(1, $result);
190 return current($result);
198 $result = $this->
object->begin($action[
"id"]);
199 $this->assertTrue($result);
207 $result = $this->
object->finish($action[
"id"]);
208 $this->assertTrue($result);
210 'actions',
'SELECT * FROM actions WHERE DAY(end) = DAY(NOW())'
212 $row_count = $queryTable->getRowCount();
213 $this->assertEquals(1, $row_count);
221 $result = $this->
object->reset_job($action[
"id"]);
222 $this->assertTrue($result);
224 'actions',
'SELECT * FROM actions WHERE end = 0 AND begin = 0 AND status = 0'
226 $this->assertEquals(1, $queryTable->getRowCount());
235 $result = $this->
object->get_job();
236 $this->assertTrue(is_array($result));
237 $this->assertCount(1, $result);
245 $result = $this->
object->cancel($variable[
"id"]);
246 $this->assertTrue($result);
248 'actions',
'SELECT * FROM actions WHERE DAY(end) = DAY(NOW())'
250 $row_count = $queryTable->getRowCount();
251 $this->assertEquals(1, $row_count);
This class manage actions to be performed on the file system on behalf of alternc Classes It primary ...
Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-03-13 at 15:55:58.
testFix_dir()
@covers m_action::fix_dir
testDo_action()
@covers m_action::do_action
testChmod()
@covers m_action::chmod
testGet_action()
@covers m_action::get_action
testCreate_file()
@covers m_action::create_file
testDel()
@covers m_action::del
testSet()
@covers m_action::set
testGet_job()
@covers m_action::get_job
testCancel($variable)
@covers m_action::cancel @depends testGet_action
tearDown()
Tears down the fixture, for example, closes a network connection.
testPurge()
@covers m_action::purge
testCreate_dir()
@covers m_action::create_dir
testFix_user()
@covers m_action::fix_user
testFix_file()
@covers m_action::fix_file
testGet_old()
@covers m_action::get_old
testMove()
@covers m_action::move
testArchive()
@covers m_action::archive
setUp()
Sets up the fixture, for example, opens a network connection.
testFinish($action)
@covers m_action::finish @depends testGet_action
testBegin($action)
@covers m_action::begin @depends testGet_action
testReset_job($action)
@covers m_action::reset_job @depends testGet_action
$list
Show a list of all found log files for an account and allow to see / tail / download them.