| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- App::uses('ChmodLib', 'Tools.Utility');
- /**
- * testing
- * 2009-07-15 ms
- */
- class ChmodLibTest extends CakeTestCase {
- public $Chmod = null;
- public function setUp() {
- $this->Chmod = new ChmodLib();
- }
- /** Start **/
- public function testConvertFromOctal() {
- $is = $this->Chmod->convertFromOctal(0777);
- $expected = '777';
- $this->assertEquals($expected, $is);
- $is = $this->Chmod->convertFromOctal(0777, true);
- $expected = '0777';
- $this->assertEquals($expected, $is);
- }
- public function testConvertToOctal() {
- $is = $this->Chmod->convertToOctal(777);
- $expected = 0777;
- $this->assertEquals($expected, $is);
- $is = $this->Chmod->convertToOctal('777');
- $expected = 0777;
- $this->assertEquals($expected, $is);
- $is = $this->Chmod->convertToOctal('0777');
- $expected = 0777;
- $this->assertEquals($expected, $is);
- }
- public function testChmod() {
- $this->Chmod->setUser(true, true, true);
- $this->Chmod->setGroup(true, true, true);
- $this->Chmod->setOther(true, true, true);
- $is = $this->Chmod->getMode();
- $expected = 0777;
- $this->assertEquals($expected, $is);
- $is = $this->Chmod->getMode(array('type'=>'string'));
- $expected = '777';
- $this->assertEquals($expected, $is);
- $is = $this->Chmod->getMode(array('type'=>'int'));
- $expected = 777;
- $this->assertEquals($expected, $is);
- $is = $this->Chmod->getMode(array('type'=>'symbolic'));
- $expected = 'rwxrwxrwx';
- $this->assertEquals($expected, $is);
- }
- /** End **/
- }
|