Alternc  latest
Alternc logiel libre pour l'h├ębergement
 All Classes Namespaces Files Functions Variables Pages
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)
 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

AlterncTest::getConnection ( )
inherited
Returns
PHPUnit_Extensions_Database_DB_IDatabaseConnection

Definition at line 11 of file AlterncTest.php.

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_variablesTest\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(), m_actionTest\testSet(), m_variablesTest\testVariable_create(), and m_variablesTest\testVariable_update().

12  {
13  global $database,$user,$password;
14  $pdo = new PDO('mysql:dbname='.$database.';host=127.0.0.1',$user,$password);
15  return $this->createDefaultDBConnection($pdo);
16  }
$user
Definition: bootstrap.php:84
foreach(array(ALTERNC_MAIL, ALTERNC_HTML, ALTERNC_LOGS) as $crdir) $database
Definition: bootstrap.php:83
$password
Definition: bootstrap.php:85
AlterncTest::loadDataSet (   $fileList)
inherited
Parameters
string$fileList
Returns
Exceptions
Exception

Definition at line 24 of file AlterncTest.php.

References PHPUNIT_DATASETS_PATH.

Referenced by m_actionTest\testPurge(), and m_variablesTest\testVariable_update().

25  {
26  if (empty($fileList)) {
27  throw new \Exception("No files specified");
28  }
29  if( !is_array($fileList)){
30  $fileList = array($fileList);
31  }
32  $datasetList = array();
33  foreach ($fileList as $file_name) {
34  $file = PHPUNIT_DATASETS_PATH."/$file_name";
35  if( !is_file($file) ){
36  throw new \Exception("missing $file");
37  }
38  $dataSet = new PHPUnit_Extensions_Database_DataSet_YamlDataSet($file);
39  $datasetList[] = $dataSet;
40  }
41  $compositeDataSet = new PHPUnit_Extensions_Database_DataSet_CompositeDataSet($datasetList);
42  return $dataSet;
43  }
const PHPUNIT_DATASETS_PATH
Definition: bootstrap.php:20
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  }
DummyTest::setUp ( )
protected

The setup is automatically run before each test.

Definition at line 53 of file DummyTest.php.

54  {
55  }
DummyTest::tearDown ( )
protected

The tearDown is automatically run after each test.

Definition at line 60 of file DummyTest.php.

61  {
62  parent::tearDown();
63  }
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  }
DummyTest::testHasDependancy (   $dependancyStatus)

testDependance

Parameters
bool$dependancyStatusReceived from dependance return

Definition at line 89 of file DummyTest.php.

90  {
91  $this->assertTrue($dependancyStatus);
92  }
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: