Skip to content

Commit

Permalink
CK101UtilityTest
Browse files Browse the repository at this point in the history
  • Loading branch information
fukuball committed Dec 17, 2013
1 parent 5c16446 commit 6dd1b3d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions test/CK101UtilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,46 @@ class CK101UtilityTest extends PHPUnit_Framework_TestCase
public function testCopyDirectory()
{

$source_folder = dirname(__FILE__).'/test-data/test-copy-directory';
$source_folder = dirname(__FILE__).'/test-data/test-parent-directory';
$destination_folder = dirname(__FILE__).'/test-data/copyed-directory';

CK101Utility::copy_directory($source_folder, $destination_folder);
$copy_options = array('mode'=>'debug');
CK101Utility::copy_directory($source_folder, $destination_folder, $copy_options);

$copy_directory_exist = file_exists($destination_folder);
$copy_file1_exist = file_exists($destination_folder.'/images1.png');
$copy_file2_exist = file_exists($destination_folder.'/images2.png');
$copy_parent_folder_exist = file_exists($destination_folder);
$copy_file1_exist = file_exists($destination_folder.'/images1.png');
$copy_sub_folder_exist = file_exists($destination_folder.'/test-sub-directory');
$copy_file2_exist = file_exists($destination_folder.'/test-sub-directory/images2.png');

CK101Utility::delete_directory($destination_folder);
$delete_options = array('mode'=>'debug');
CK101Utility::delete_directory($destination_folder, $delete_options);

$this->assertEquals(true, $copy_directory_exist);
$this->assertEquals(true, $copy_parent_folder_exist);
$this->assertEquals(true, $copy_file1_exist);
$this->assertEquals(true, $copy_sub_folder_exist);
$this->assertEquals(true, $copy_file2_exist);

}

public function testDeleteDirectory()
{

$source_folder = dirname(__FILE__).'/test-data/test-copy-directory';
$source_folder = dirname(__FILE__).'/test-data/test-parent-directory';
$destination_folder = dirname(__FILE__).'/test-data/copyed-directory';

CK101Utility::copy_directory($source_folder, $destination_folder);
CK101Utility::delete_directory($destination_folder);
$copy_options = array('mode'=>'debug');
CK101Utility::copy_directory($source_folder, $destination_folder, $copy_options);
$delete_options = array('mode'=>'debug');
CK101Utility::delete_directory($destination_folder, $delete_options);

$copy_directory_exist = file_exists($destination_folder);
$copy_file1_exist = file_exists($destination_folder.'/images1.png');
$copy_file2_exist = file_exists($destination_folder.'/images2.png');
$copy_parent_folder_exist = file_exists($destination_folder);
$copy_file1_exist = file_exists($destination_folder.'/images1.png');
$copy_sub_folder_exist = file_exists($destination_folder.'/test-sub-directory');
$copy_file2_exist = file_exists($destination_folder.'/test-sub-directory/images2.png');

$this->assertEquals(false, $copy_directory_exist);
$this->assertEquals(false, $copy_parent_folder_exist);
$this->assertEquals(false, $copy_file1_exist);
$this->assertEquals(false, $copy_sub_folder_exist);
$this->assertEquals(false, $copy_file2_exist);
}
}
Expand Down

0 comments on commit 6dd1b3d

Please sign in to comment.