Alternc  latest
Alternc logiel libre pour l'hébergement
m_htaTest.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-03-13 at 15:55:58.
4  */
5 use PHPUnit\Framework\TestCase;
6 
7 class m_htaTest extends TestCase
8 {
9  /**
10  * @var m_hta
11  */
12  protected $object;
13 
14  const PATH_HTACCESS = "/tmp/.htaccess";
15  const PATH_HTPASSWD = "/tmp/.htpasswd";
16 
17  /**
18  * Sets up the fixture, for example, opens a network connection.
19  * This method is called before a test is executed.
20  */
21  protected function setUp()
22  {
23  parent::setUp();
24  touch(self::PATH_HTACCESS);
25  touch(self::PATH_HTPASSWD);
26  $file_content = "AuthUserFile \"/tmp/.htpasswd\"\nAuthName \"Restricted area\"\nAuthType Basic\nrequire valid-user\n";
27  file_put_contents(self::PATH_HTACCESS,$file_content);
28  $this->object = new m_hta;
29  }
30 
31  /**
32  * Tears down the fixture, for example, closes a network connection.
33  * This method is called after a test is executed.
34  */
35  protected function tearDown()
36  {
37  parent::tearDown();
38  if(file_exists(self::PATH_HTACCESS)){
39  unlink (self::PATH_HTACCESS);
40  }
41  if(file_exists(self::PATH_HTPASSWD)){
42  unlink (self::PATH_HTPASSWD);
43  }
44  }
45 
46  /**
47  * @covers m_hta::m_webaccess
48  * @todo Implement testM_webaccess().
49  */
50  public function testM_webaccess()
51  {
52  // Remove the following lines when you implement this test.
53  $this->markTestIncomplete(
54  'This test has not been implemented yet.'
55  );
56  }
57 
58  /**
59  * @covers m_hta::alternc_password_policy
60  * @todo Implement testAlternc_password_policy().
61  */
62  public function testAlternc_password_policy()
63  {
64  // Remove the following lines when you implement this test.
65  $this->markTestIncomplete(
66  'This test has not been implemented yet.'
67  );
68  }
69 
70  /**
71  * @covers m_hta::hook_menu
72  * @todo Implement testHook_menu().
73  */
74  public function testHook_menu()
75  {
76  // Remove the following lines when you implement this test.
77  $this->markTestIncomplete(
78  'This test has not been implemented yet.'
79  );
80  }
81 
82  /**
83  * @covers m_hta::CreateDir
84  * @todo Implement testCreateDir().
85  */
86  public function testCreateDir()
87  {
88  // Remove the following lines when you implement this test.
89  $this->markTestIncomplete(
90  'This test has not been implemented yet.'
91  );
92  }
93 
94  /**
95  * @covers m_hta::ListDir
96  * @todo Implement testListDir().
97  */
98  public function testListDir()
99  {
100  // Remove the following lines when you implement this test.
101  $this->markTestIncomplete(
102  'This test has not been implemented yet.'
103  );
104  }
105 
106  /**
107  * @covers m_hta::is_protected
108  * @todo Implement testIs_protected().
109  */
110  public function testIs_protected()
111  {
112  // Remove the following lines when you implement this test.
113  $this->markTestIncomplete(
114  'This test has not been implemented yet.'
115  );
116  }
117 
118  /**
119  * @covers m_hta::get_hta_detail
120  * @todo Implement testGet_hta_detail().
121  */
122  public function testGet_hta_detail()
123  {
124  // Remove the following lines when you implement this test.
125  $this->markTestIncomplete(
126  'This test has not been implemented yet.'
127  );
128  }
129 
130  /**
131  * @covers m_hta::DelDir
132  */
133  public function testDelDir()
134  {
135  $result = $this->object->DelDir("/tmp",TRUE);
136  $this->assertTrue($result);
137  $this->assertFileNotExists(self::PATH_HTACCESS);
138  $this->assertFileNotExists(self::PATH_HTPASSWD);
139  }
140 
141  /**
142  * @covers m_hta::DelDir
143  */
144  public function testDelDirNotEmpty()
145  {
146  file_put_contents(self::PATH_HTACCESS, "\nphpunit", FILE_APPEND);
147  $result = $this->object->DelDir("/tmp",TRUE);
148  $this->assertTrue($result);
149  $this->assertFileExists(self::PATH_HTACCESS);
150  $this->assertFileNotExists(self::PATH_HTPASSWD);
151  $this->assertTrue("phpunit" == trim(file_get_contents(self::PATH_HTACCESS)));
152  }
153 
154  /**
155  * @covers m_hta::add_user
156  * @todo Implement testAdd_user().
157  */
158  public function testAdd_user()
159  {
160  // Remove the following lines when you implement this test.
161  $this->markTestIncomplete(
162  'This test has not been implemented yet.'
163  );
164  }
165 
166  /**
167  * @covers m_hta::del_user
168  * @todo Implement testDel_user().
169  */
170  public function testDel_user()
171  {
172  // Remove the following lines when you implement this test.
173  $this->markTestIncomplete(
174  'This test has not been implemented yet.'
175  );
176  }
177 
178  /**
179  * @covers m_hta::change_pass
180  * @todo Implement testChange_pass().
181  */
182  public function testChange_pass()
183  {
184  // Remove the following lines when you implement this test.
185  $this->markTestIncomplete(
186  'This test has not been implemented yet.'
187  );
188  }
189 
190  /**
191  * @covers m_hta::_reading_htaccess
192  * @todo Implement test_reading_htaccess().
193  */
194  public function test_reading_htaccess()
195  {
196  // Remove the following lines when you implement this test.
197  $this->markTestIncomplete(
198  'This test has not been implemented yet.'
199  );
200  }
201 }
This class handle folder web restricted access through .htaccess/.htpassword files.
Definition: m_hta.php:27
testCreateDir()
@covers m_hta::CreateDir
Definition: m_htaTest.php:86
testAlternc_password_policy()
@covers m_hta::alternc_password_policy
Definition: m_htaTest.php:62
test_reading_htaccess()
@covers m_hta::_reading_htaccess
Definition: m_htaTest.php:194
testDel_user()
@covers m_hta::del_user
Definition: m_htaTest.php:170
const PATH_HTPASSWD
Definition: m_htaTest.php:15
testM_webaccess()
@covers m_hta::m_webaccess
Definition: m_htaTest.php:50
testDelDirNotEmpty()
@covers m_hta::DelDir
Definition: m_htaTest.php:144
testDelDir()
@covers m_hta::DelDir
Definition: m_htaTest.php:133
testListDir()
@covers m_hta::ListDir
Definition: m_htaTest.php:98
testChange_pass()
@covers m_hta::change_pass
Definition: m_htaTest.php:182
tearDown()
Tears down the fixture, for example, closes a network connection.
Definition: m_htaTest.php:35
testHook_menu()
@covers m_hta::hook_menu
Definition: m_htaTest.php:74
setUp()
Sets up the fixture, for example, opens a network connection.
Definition: m_htaTest.php:21
testIs_protected()
@covers m_hta::is_protected
Definition: m_htaTest.php:110
testAdd_user()
@covers m_hta::add_user
Definition: m_htaTest.php:158
testGet_hta_detail()
@covers m_hta::get_hta_detail
Definition: m_htaTest.php:122
const PATH_HTACCESS
Definition: m_htaTest.php:14