Alternc  latest
Alternc logiel libre pour l'hébergement
DummyTest Class Reference

This is a fake test for the purpose of showing how tests work and eventually validate the test environment works. More...

+ Inheritance diagram for DummyTest:

Public Member Functions

 testDependance ()
 This function will be executed by methods. More...
 
 testHasDependancy ( $dependancyStatus)
 @depends testDependance More...
 
 testPushAndPop ()
 
 getConnection ()
 
 loadDataSet ($fileList)
 

Protected Member Functions

 setUp ()
 The setup is automatically run before each test. More...
 
 tearDown ()
 The tearDown is automatically run after each test. More...
 
 notTested ()
 This function will NOT be executed as its name doesn't start with test*. More...
 

Detailed Description

This is a fake test for the purpose of showing how tests work and eventually validate the test environment works.

The following methods are available : assertArrayHasKey() assertClassHasAttribute() assertClassHasStaticAttribute() assertContains() assertContainsOnly() assertContainsOnlyInstancesOf() assertCount() assertEmpty() assertEqualXMLStructure() assertEquals() assertFalse() assertFileEquals() assertFileExists() assertGreaterThan() assertGreaterThanOrEqual() assertInstanceOf() assertInternalType() assertJsonFileEqualsJsonFile() assertJsonStringEqualsJsonFile() assertJsonStringEqualsJsonString() assertLessThan() assertLessThanOrEqual() assertNull() assertObjectHasAttribute() assertRegExp() assertStringMatchesFormat() assertStringMatchesFormatFile() assertSame() assertSelectCount() assertSelectEquals() assertSelectRegExp() assertStringEndsWith() assertStringEqualsFile() assertStringStartsWith() assertTag() assertThat() assertTrue() assertXmlFileEqualsXmlFile() assertXmlStringEqualsXmlFile() assertXmlStringEqualsXmlString()

Definition at line 48 of file DummyTest.php.

Member Function Documentation

◆ getConnection()

AlterncTest::getConnection ( )
inherited
Returns
PHPUnit_Extensions_Database_DB_IDatabaseConnection

Definition at line 18 of file AlterncTest.php.

19  {
20  global $database,$user,$password;
21  $pdo = new PDO('mysql:dbname='.$database.';host=127.0.0.1',$user,$password);
22  return $this->createDefaultDBConnection($pdo);
23  }
foreach(array(ALTERNC_MAIL, ALTERNC_HTML, ALTERNC_LOGS) as $crdir) $database
Definition: bootstrap.php:83
$user
Definition: bootstrap.php:84
$password
Definition: bootstrap.php:85

References $database, $password, and $user.

Referenced by m_actionTest\testArchive(), m_actionTest\testCancel(), m_actionTest\testChmod(), m_actionTest\testCreate_dir(), m_actionTest\testCreate_file(), m_actionTest\testDel(), m_actionTest\testFinish(), m_actionTest\testFix_dir(), m_actionTest\testFix_file(), m_actionTest\testFix_user(), m_actionTest\testMove(), m_actionTest\testPurge(), m_actionTest\testReset_job(), and m_actionTest\testSet().

◆ loadDataSet()

AlterncTest::loadDataSet (   $fileList)
inherited
Parameters
string$fileList
Returns
\PHPUnit_Extensions_Database_DataSet_YamlDataSet
Exceptions

Definition at line 31 of file AlterncTest.php.

32  {
33  if (empty($fileList)) {
34  throw new \Exception("No files specified");
35  }
36  if( !is_array($fileList)){
37  $fileList = array($fileList);
38  }
39  $datasetList = array();
40  foreach ($fileList as $file_name) {
41  $file = PHPUNIT_DATASETS_PATH."/$file_name";
42  if( !is_file($file) ){
43  throw new \Exception("missing $file");
44  }
45  $dataSet = new YamlDataSet($file);
46  $datasetList[] = $dataSet;
47  }
48  $compositeDataSet = new CompositeDataSet($datasetList);
49  return $dataSet;
50  }
const PHPUNIT_DATASETS_PATH
Definition: bootstrap.php:20

References PHPUNIT_DATASETS_PATH.

Referenced by m_actionTest\testPurge().

◆ notTested()

DummyTest::notTested ( )
protected

This function will NOT be executed as its name doesn't start with test*.

Definition at line 70 of file DummyTest.php.

71  {
72 
73  }

◆ setUp()

DummyTest::setUp ( )
protected

The setup is automatically run before each test.

Definition at line 53 of file DummyTest.php.

54  {
55  }

◆ tearDown()

DummyTest::tearDown ( )
protected

The tearDown is automatically run after each test.

Definition at line 60 of file DummyTest.php.

61  {
62  parent::tearDown();
63  }

◆ testDependance()

DummyTest::testDependance ( )

This function will be executed by methods.

Returns
boolean

Definition at line 79 of file DummyTest.php.

80  {
81  $this->assertTrue(TRUE);
82  return TRUE;
83  }

◆ testHasDependancy()

DummyTest::testHasDependancy (   $dependancyStatus)

@depends testDependance

Parameters
bool$dependancyStatusReceived from dependance return

Definition at line 89 of file DummyTest.php.

90  {
91  $this->assertTrue($dependancyStatus);
92  }

◆ testPushAndPop()

DummyTest::testPushAndPop ( )

Definition at line 95 of file DummyTest.php.

96  {
97  $stack = array();
98  $this->assertEquals(0, count($stack));
99 
100  array_push($stack, 'foo');
101  $this->assertEquals('foo', $stack[count($stack)-1]);
102  $this->assertEquals(1, count($stack));
103 
104  $this->assertEquals('foo', array_pop($stack));
105  $this->assertEquals(0, count($stack));
106  }

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