Alternc  3.2
Alternc logiel libre pour l'hébergement
 All Data Structures Namespaces Files Functions Variables Pages
m_actionTest Class Reference

Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-03-13 at 15:55:58. More...

+ Inheritance diagram for m_actionTest:

Public Member Functions

 getDataSet ()
 testDo_action ()
 m_action::do_action
 testCreate_file ()
 m_action::create_file
 testCreate_dir ()
 m_action::create_dir
 testFix_user ()
 m_action::fix_user
 testFix_dir ()
 m_action::fix_dir
 testFix_file ()
 m_action::fix_file
 testDel ()
 m_action::del
 testMove ()
 m_action::move
 testArchive ()
 m_action::archive
 testSet ()
 m_action::set
 testGet_old ()
 m_action::get_old
 testPurge ()
 m_action::purge
 testGet_action ()
 m_action::get_action
 testBegin ($action)
 m_action::begin testGet_action
 testFinish ($action)
 m_action::finish testGet_action
 testReset_job ($action)
 m_action::reset_job testGet_action
 testGet_job ()
 m_action::get_job
 testCancel ($variable)
 m_action::cancel testGet_action
- Public Member Functions inherited from AlterncTest
 getConnection ()
 loadDataSet ($file_name)

Data Fields

const TEST_FILE = "/tmp/phpunit-actionTest-file"
const TEST_DIR = "/tmp/phpunit-actionTest-dir"
const TEST_UID = 999

Protected Member Functions

 setUp ()
 Sets up the fixture, for example, opens a network connection.
 tearDown ()
 Tears down the fixture, for example, closes a network connection.

Protected Attributes

 $object

Detailed Description

Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-03-13 at 15:55:58.

Definition at line 6 of file m_actionTest.php.

Member Function Documentation

getDataSet ( )
Returns
PHPUnit_Extensions_Database_DataSet_IDataSet

Definition at line 20 of file m_actionTest.php.

References $list, isset, and AlterncTest\loadDataSet().

{
$list = array(
"testPurge" => "actions-purgeable.yml",
"testGet_action" => "actions-purgeable.yml",
"testGet_old" => "actions-purgeable.yml",
"testFinish" => "actions-purgeable.yml",
"testReset_job" => "actions-began.yml",
"testGet_job" => "actions-ready.yml",
"testCancel" => "actions-purgeable.yml",
"default" => "actions-purgeable.yml"
);
if (isset($list[$this->getName()])) {
$dataset_file = $list[$this->getName()];
} else {
$dataset_file = "actions-empty.yml";
}
return parent::loadDataSet($dataset_file);
}
setUp ( )
protected

Sets up the fixture, for example, opens a network connection.

This method is called before a test is executed.

Definition at line 44 of file m_actionTest.php.

{
$this->object = new m_action;
}
tearDown ( )
protected

Tears down the fixture, for example, closes a network connection.

This method is called after a test is executed.

Definition at line 53 of file m_actionTest.php.

{
global $L_INOTIFY_DO_ACTION;
// Removes flag file eventually created
if (is_file($L_INOTIFY_DO_ACTION)) {
unlink($L_INOTIFY_DO_ACTION);
}
}
testArchive ( )

m_action::archive

Definition at line 138 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->archive(self::TEST_DIR);
$this->assertTrue($result);
$this->assertEquals(1, $this->getConnection()->getRowCount('actions'));
}
testBegin (   $action)

m_action::begin testGet_action

Definition at line 187 of file m_actionTest.php.

{
$result = $this->object->begin($action["id"]);
$this->assertTrue($result);
}
testCancel (   $variable)

m_action::cancel testGet_action

Definition at line 234 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->cancel($variable["id"]);
$this->assertTrue($result);
$queryTable = $this->getConnection()->createQueryTable(
'actions', 'SELECT * FROM actions WHERE DAY(end) = DAY(NOW())'
);
$row_count = $queryTable->getRowCount();
$this->assertEquals(1, $row_count);
}
testCreate_dir ( )

m_action::create_dir

Definition at line 84 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->create_dir(self::TEST_FILE);
$this->assertTrue($result);
$this->assertEquals(1, $this->getConnection()->getRowCount('actions'));
}
testCreate_file ( )

m_action::create_file

Definition at line 75 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->create_file(self::TEST_FILE, "phpunit");
$this->assertTrue($result);
$this->assertEquals(1, $this->getConnection()->getRowCount('actions'));
}
testDel ( )

m_action::del

Definition at line 120 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->del(self::TEST_DIR);
$this->assertTrue($result);
$this->assertEquals(1, $this->getConnection()->getRowCount('actions'));
}
testDo_action ( )

m_action::do_action

Definition at line 65 of file m_actionTest.php.

{
global $L_INOTIFY_DO_ACTION;
$result = $this->object->do_action();
$this->assertTrue($result);
$this->assertFileExists($L_INOTIFY_DO_ACTION);
}
testFinish (   $action)

m_action::finish testGet_action

Definition at line 196 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->finish($action["id"]);
$this->assertTrue($result);
$queryTable = $this->getConnection()->createQueryTable(
'actions', 'SELECT * FROM actions WHERE DAY(end) = DAY(NOW())'
);
$row_count = $queryTable->getRowCount();
$this->assertEquals(1, $row_count);
}
testFix_dir ( )

m_action::fix_dir

Definition at line 102 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->fix_dir(self::TEST_DIR);
$this->assertTrue($result);
$this->assertEquals(1, $this->getConnection()->getRowCount('actions'));
}
testFix_file ( )

m_action::fix_file

Definition at line 111 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->fix_file(self::TEST_FILE);
$this->assertTrue($result);
$this->assertEquals(1, $this->getConnection()->getRowCount('actions'));
}
testFix_user ( )

m_action::fix_user

Definition at line 93 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->fix_user(self::TEST_UID);
$this->assertTrue($result);
$this->assertEquals(1, $this->getConnection()->getRowCount('actions'));
}
testGet_action ( )

m_action::get_action

Definition at line 176 of file m_actionTest.php.

{
$result = $this->object->get_action();
$this->assertTrue(is_array($result));
$this->assertCount(1, $result);
return current($result);
}
testGet_job ( )

m_action::get_job

Definition at line 224 of file m_actionTest.php.

{
$result = $this->object->get_job();
$this->assertTrue(is_array($result));
$this->assertCount(1, $result);
}
testGet_old ( )

m_action::get_old

Definition at line 157 of file m_actionTest.php.

{
$result = $this->object->get_old();
$this->assertEquals(1, $result);
}
testMove ( )

m_action::move

Definition at line 129 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->move(self::TEST_FILE, self::TEST_DIR);
$this->assertTrue($result);
$this->assertEquals(1, $this->getConnection()->getRowCount('actions'));
}
testPurge ( )

m_action::purge

Definition at line 165 of file m_actionTest.php.

References AlterncTest\getConnection(), and AlterncTest\loadDataSet().

{
$result = $this->object->purge();
$this->assertEquals(0, $result);
$expectedTable = $this->loadDataSet("actions-empty.yml")->getTable("actions");
$currentTable = $this->getConnection()->createQueryTable('actions', 'SELECT * FROM actions');
$this->assertTablesEqual($expectedTable, $currentTable);
}
testReset_job (   $action)

m_action::reset_job testGet_action

Definition at line 210 of file m_actionTest.php.

References AlterncTest\getConnection().

{
$result = $this->object->reset_job($action["id"]);
$this->assertTrue($result);
$queryTable = $this->getConnection()->createQueryTable(
'actions', 'SELECT * FROM actions WHERE end = 0 AND begin = 0 AND status = 0'
);
$this->assertEquals(1, $queryTable->getRowCount());
}
testSet ( )

m_action::set

Definition at line 147 of file m_actionTest.php.

References AlterncTest\getConnection().

{
// We test only failure, other methods cover success
$result = $this->object->set(null, null, null);
$this->assertFalse($result);
$this->assertEquals(0, $this->getConnection()->getRowCount('actions'));
}

Field Documentation

$object
protected

Definition at line 11 of file m_actionTest.php.

const TEST_DIR = "/tmp/phpunit-actionTest-dir"

Definition at line 14 of file m_actionTest.php.

const TEST_FILE = "/tmp/phpunit-actionTest-file"

Definition at line 13 of file m_actionTest.php.

const TEST_UID = 999

Definition at line 15 of file m_actionTest.php.


The documentation for this class was generated from the following file: