| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- App::uses('ChmodLib', 'Tools.Utility');
- /**
- * testing
- * 2009-07-15 ms
- */
- class ChmodLibTest extends CakeTestCase {
- public $Chmod = null;
- public function setUp() {
- parent::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 **/
- }
|