Version Description
Download this release
Release Info
Developer | willmot |
Plugin | The WP Remote WordPress Plugin |
Version | 2.4.11 |
Comparing to | |
See all releases |
Code changes from version 2.4.10 to 2.4.11
- backupwordpress/hm-backup/tests/test-data/exclude/exclude.exclude +0 -1
- backupwordpress/hm-backup/tests/test-data/test-data.txt +0 -1
- backupwordpress/hm-backup/tests/testBackUpProcess.php +0 -200
- backupwordpress/hm-backup/tests/testBackupProperties.php +0 -162
- backupwordpress/hm-backup/tests/testBrokenSymlink.php +0 -134
- backupwordpress/hm-backup/tests/testConformDir.php +0 -70
- backupwordpress/hm-backup/tests/testDatabaseDump.php +0 -76
- backupwordpress/hm-backup/tests/testExcludes.php +0 -537
- backupwordpress/hm-backup/tests/testSymlinkDir.php +0 -128
- backupwordpress/hm-backup/tests/testSymlinkFile.php +0 -128
- backupwordpress/hm-backup/tests/testUnreadableFile.php +0 -121
- backupwordpress/tests/testFullBackup.php +0 -129
- backupwordpress/tests/testImport.php +0 -5
- backupwordpress/tests/testMoveBackupPath.php +0 -155
- backupwordpress/tests/testSchedule.php +0 -70
- plugin.php +1 -1
- readme.txt +5 -1
backupwordpress/hm-backup/tests/test-data/exclude/exclude.exclude
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Exclude me please
|
|
backupwordpress/hm-backup/tests/test-data/test-data.txt
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla adipiscing tincidunt dictum. Cras sed elit in ligula volutpat egestas et ac ipsum. Maecenas vitae lorem nulla, vel lacinia ligula. Duis varius nibh consequat dui lacinia tempor eu eu ipsum. Cras gravida metus ut elit eleifend mattis. Cras porta dignissim elit, at tincidunt ante pellentesque vitae. Nam dictum dapibus arcu, vitae tincidunt nunc semper eu. Pellentesque ornare interdum arcu, sit amet molestie orci malesuada a. Morbi ac lacus a lorem consectetur auctor. Suspendisse facilisis nisi vitae nisi convallis a blandit odio imperdiet. Ut lobortis luctus lacinia. Maecenas malesuada ultrices dui.
|
|
backupwordpress/hm-backup/tests/testBackUpProcess.php
DELETED
@@ -1,200 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests for the complete backup process both with
|
5 |
-
* the shell commands and with the PHP fallbacks
|
6 |
-
*
|
7 |
-
* @extends WP_UnitTestCase
|
8 |
-
*/
|
9 |
-
class testBackUpProcessTestCase extends WP_UnitTestCase {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Contains the current backup instance
|
13 |
-
*
|
14 |
-
* @var object
|
15 |
-
* @access protected
|
16 |
-
*/
|
17 |
-
protected $backup;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Setup the backup object and create the tmp directory
|
21 |
-
*
|
22 |
-
* @access public
|
23 |
-
*/
|
24 |
-
public function setUp() {
|
25 |
-
|
26 |
-
$this->backup = new HM_Backup();
|
27 |
-
$this->backup->set_root( dirname( __FILE__ ) . '/test-data/' );
|
28 |
-
$this->backup->set_path( dirname( __FILE__ ) . '/tmp' );
|
29 |
-
|
30 |
-
mkdir( dirname( __FILE__ ) . '/tmp' );
|
31 |
-
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Cleanup the backup file and tmp directory
|
36 |
-
* after every test
|
37 |
-
*
|
38 |
-
* @access public
|
39 |
-
*/
|
40 |
-
public function tearDown() {
|
41 |
-
|
42 |
-
hmbkp_rmdirtree( $this->backup->get_path() );
|
43 |
-
|
44 |
-
unset( $this->backup );
|
45 |
-
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Test a full backup with the shell commands
|
50 |
-
*
|
51 |
-
* @access public
|
52 |
-
*/
|
53 |
-
public function testFullBackupWithCommands() {
|
54 |
-
|
55 |
-
if ( ! $this->backup->get_zip_command_path() )
|
56 |
-
$this->markTestSkipped( 'Empty zip command path' );
|
57 |
-
|
58 |
-
if ( ! $this->backup->get_mysqldump_command_path() )
|
59 |
-
$this->markTestSkipped( 'Empty mysqldump command path' );
|
60 |
-
|
61 |
-
$this->backup->backup();
|
62 |
-
|
63 |
-
$this->assertEquals( $this->backup->get_archive_method(), 'zip' );
|
64 |
-
$this->assertEquals( $this->backup->get_mysqldump_method(), 'mysqldump' );
|
65 |
-
|
66 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
67 |
-
|
68 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( 'test-data.txt', $this->backup->get_database_dump_filename() ) );
|
69 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 4 );
|
70 |
-
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Test a full backup with the ZipArchive
|
75 |
-
*
|
76 |
-
* @access public
|
77 |
-
*/
|
78 |
-
public function testFullBackupWithZipArchiveMysqldumpFallback() {
|
79 |
-
|
80 |
-
$this->backup->set_zip_command_path( false );
|
81 |
-
$this->backup->set_mysqldump_command_path( false );
|
82 |
-
|
83 |
-
$this->assertTrue( class_exists( 'ZipArchive' ) );
|
84 |
-
|
85 |
-
$this->backup->backup();
|
86 |
-
|
87 |
-
$this->assertEquals( $this->backup->get_archive_method(), 'ziparchive' );
|
88 |
-
$this->assertEquals( $this->backup->get_mysqldump_method(), 'mysqldump_fallback' );
|
89 |
-
|
90 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
91 |
-
|
92 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( 'test-data.txt', $this->backup->get_database_dump_filename() ) );
|
93 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 4 );
|
94 |
-
|
95 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
96 |
-
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Test a full backup with the PclZip
|
101 |
-
*
|
102 |
-
* @access public
|
103 |
-
*/
|
104 |
-
public function testFullBackupWithPclZipAndMysqldumpFallback() {
|
105 |
-
|
106 |
-
$this->backup->set_zip_command_path( false );
|
107 |
-
$this->backup->set_mysqldump_command_path( false );
|
108 |
-
|
109 |
-
$this->backup->skip_zip_archive = true;
|
110 |
-
|
111 |
-
$this->backup->backup();
|
112 |
-
|
113 |
-
$this->assertEquals( $this->backup->get_archive_method(), 'pclzip' );
|
114 |
-
$this->assertEquals( $this->backup->get_mysqldump_method(), 'mysqldump_fallback' );
|
115 |
-
|
116 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
117 |
-
|
118 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( 'test-data.txt', $this->backup->get_database_dump_filename() ) );
|
119 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 4 );
|
120 |
-
|
121 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
122 |
-
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Test a files only backup with the zip command
|
127 |
-
*
|
128 |
-
* @access public
|
129 |
-
*/
|
130 |
-
public function testFileOnlyWithZipCommand() {
|
131 |
-
|
132 |
-
$this->backup->set_type( 'file' );
|
133 |
-
|
134 |
-
if ( ! $this->backup->get_zip_command_path() )
|
135 |
-
$this->markTestSkipped( "Empty zip command path" );
|
136 |
-
|
137 |
-
$this->backup->backup();
|
138 |
-
|
139 |
-
$this->assertEquals( $this->backup->get_archive_method(), 'zip' );
|
140 |
-
|
141 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
142 |
-
|
143 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( 'test-data.txt' ) );
|
144 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 3 );
|
145 |
-
|
146 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
147 |
-
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Test a files only backup with ZipArchive
|
152 |
-
*
|
153 |
-
* @access public
|
154 |
-
*/
|
155 |
-
public function testFileOnlyWithZipArchive() {
|
156 |
-
|
157 |
-
$this->backup->set_type( 'file' );
|
158 |
-
$this->backup->set_zip_command_path( false );
|
159 |
-
|
160 |
-
$this->assertTrue( class_exists( 'ZipArchive' ) );
|
161 |
-
|
162 |
-
$this->backup->backup();
|
163 |
-
|
164 |
-
$this->assertEquals( $this->backup->get_archive_method(), 'ziparchive' );
|
165 |
-
|
166 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
167 |
-
|
168 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( 'test-data.txt' ) );
|
169 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 3 );
|
170 |
-
|
171 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
172 |
-
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Test a files only backup with PclZip
|
177 |
-
*
|
178 |
-
* @access public
|
179 |
-
*/
|
180 |
-
public function testFileOnlyWithPclZip() {
|
181 |
-
|
182 |
-
$this->backup->set_type( 'file' );
|
183 |
-
$this->backup->set_zip_command_path( false );
|
184 |
-
|
185 |
-
$this->backup->skip_zip_archive = true;
|
186 |
-
|
187 |
-
$this->backup->backup();
|
188 |
-
|
189 |
-
$this->assertEquals( $this->backup->get_archive_method(), 'pclzip' );
|
190 |
-
|
191 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
192 |
-
|
193 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( 'test-data.txt' ) );
|
194 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 3 );
|
195 |
-
|
196 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
197 |
-
|
198 |
-
}
|
199 |
-
|
200 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/hm-backup/tests/testBackupProperties.php
DELETED
@@ -1,162 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Test the the property getters works
|
5 |
-
*
|
6 |
-
* @extends WP_UnitTestCase
|
7 |
-
*/
|
8 |
-
class testPropertiesTestCase extends WP_UnitTestCase {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Contains the current backup instance
|
12 |
-
*
|
13 |
-
* @var object
|
14 |
-
* @access protected
|
15 |
-
*/
|
16 |
-
protected $backup;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Setup the backup object
|
20 |
-
*
|
21 |
-
* @access public
|
22 |
-
*/
|
23 |
-
public function setUp() {
|
24 |
-
|
25 |
-
$this->backup = new HM_Backup();
|
26 |
-
$this->backup->set_type( 'database' );
|
27 |
-
|
28 |
-
$this->custom_path = WP_CONTENT_DIR . '/custom';
|
29 |
-
|
30 |
-
mkdir( $this->custom_path );
|
31 |
-
|
32 |
-
}
|
33 |
-
|
34 |
-
public function tearDown() {
|
35 |
-
|
36 |
-
hmbkp_rmdirtree( $this->custom_path );
|
37 |
-
|
38 |
-
unset( $this->backup );
|
39 |
-
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Check that the default path is correct
|
44 |
-
*
|
45 |
-
* @access public
|
46 |
-
*/
|
47 |
-
public function testDefaultBackupPath() {
|
48 |
-
|
49 |
-
$this->assertEquals( HM_Backup::conform_dir( hmbkp_path_default() ), $this->backup->get_path() );
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* What if the backup path is in root
|
55 |
-
*
|
56 |
-
* @access public
|
57 |
-
*/
|
58 |
-
public function testRootBackupPath() {
|
59 |
-
|
60 |
-
$this->backup->set_path( '/' );
|
61 |
-
$this->backup->set_archive_filename( 'backup.zip' );
|
62 |
-
|
63 |
-
$this->assertEquals( '/', $this->backup->get_path() );
|
64 |
-
$this->assertEquals( '/backup.zip', $this->backup->get_archive_filepath() );
|
65 |
-
|
66 |
-
if ( ! is_writable( $this->backup->get_path() ) )
|
67 |
-
$this->markTestSkipped( 'Root not writable' );
|
68 |
-
|
69 |
-
$this->backup->backup();
|
70 |
-
|
71 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
72 |
-
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Make sure setting a custom path + archive filename correctly sets the archive filepath
|
77 |
-
*
|
78 |
-
* @access public
|
79 |
-
*/
|
80 |
-
public function testCustomBackupPath() {
|
81 |
-
|
82 |
-
$this->backup->set_path( WP_CONTENT_DIR . '/custom' );
|
83 |
-
$this->backup->set_archive_filename( 'backup.zip' );
|
84 |
-
|
85 |
-
$this->assertEquals( HM_Backup::conform_dir( WP_CONTENT_DIR . '/custom/backup.zip' ), $this->backup->get_archive_filepath() );
|
86 |
-
|
87 |
-
$this->backup->backup();
|
88 |
-
|
89 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
90 |
-
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Make sure setting a custom path + archive filename correctly sets the archive filepath
|
95 |
-
*
|
96 |
-
* @access public
|
97 |
-
*/
|
98 |
-
public function testUTF8BackupPath() {
|
99 |
-
|
100 |
-
$this->backup->set_archive_filename( 'sphärenriss.zip' );
|
101 |
-
|
102 |
-
$this->assertEquals( HM_Backup::conform_dir( WP_CONTENT_DIR . '/custom/spharenriss.zip' ), $this->backup->get_archive_filepath() );
|
103 |
-
|
104 |
-
$this->backup->backup();
|
105 |
-
|
106 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
107 |
-
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Make sure setting a custom path + archive filename correctly sets the archive filepath
|
112 |
-
*
|
113 |
-
* @access public
|
114 |
-
*/
|
115 |
-
public function testCrylicBackupPath() {
|
116 |
-
|
117 |
-
$this->backup->set_archive_filename( 'СПС Борски округ.zip' );
|
118 |
-
|
119 |
-
$this->assertEquals( HM_Backup::conform_dir( WP_CONTENT_DIR . '/custom/СПС Борски округ.zip' ), $this->backup->get_archive_filepath() );
|
120 |
-
|
121 |
-
$this->backup->backup();
|
122 |
-
|
123 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
124 |
-
|
125 |
-
}
|
126 |
-
|
127 |
-
/**
|
128 |
-
* Make sure setting a custom path + archive filename correctly sets the archive filepath
|
129 |
-
*
|
130 |
-
* @access public
|
131 |
-
*/
|
132 |
-
public function testChineseBackupPath() {
|
133 |
-
|
134 |
-
$this->backup->set_archive_filename( '合自然.zip' );
|
135 |
-
|
136 |
-
$this->assertEquals( HM_Backup::conform_dir( WP_CONTENT_DIR . '/custom/合自然.zip' ), $this->backup->get_archive_filepath() );
|
137 |
-
|
138 |
-
$this->backup->backup();
|
139 |
-
|
140 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
141 |
-
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Make sure setting a custom path + database dump filename correctly sets the database dump filepath
|
146 |
-
*
|
147 |
-
* @access public
|
148 |
-
*/
|
149 |
-
public function testCustomDatabaseDumpPath() {
|
150 |
-
|
151 |
-
$this->backup->set_path( WP_CONTENT_DIR . '/custom' );
|
152 |
-
$this->backup->set_database_dump_filename( 'dump.sql' );
|
153 |
-
|
154 |
-
$this->assertEquals( HM_Backup::conform_dir( WP_CONTENT_DIR . '/custom/dump.sql' ), $this->backup->get_database_dump_filepath() );
|
155 |
-
|
156 |
-
$this->backup->mysqldump();
|
157 |
-
|
158 |
-
$this->assertFileExists( $this->backup->get_database_dump_filepath() );
|
159 |
-
|
160 |
-
}
|
161 |
-
|
162 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/hm-backup/tests/testBrokenSymlink.php
DELETED
@@ -1,134 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests for the Archive process with symlinks
|
5 |
-
*
|
6 |
-
* @extends WP_UnitTestCase
|
7 |
-
*/
|
8 |
-
class testBrokenSymlinkTestCase extends WP_UnitTestCase {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Contains the current backup instance
|
12 |
-
*
|
13 |
-
* @var object
|
14 |
-
* @access protected
|
15 |
-
*/
|
16 |
-
protected $backup;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Setup the backup object and create the tmp directory
|
20 |
-
*
|
21 |
-
* @access public
|
22 |
-
*/
|
23 |
-
public function setUp() {
|
24 |
-
|
25 |
-
if ( ! function_exists( 'symlink' ) )
|
26 |
-
$this->markTestSkipped( 'symlink function not defined' );
|
27 |
-
|
28 |
-
$this->backup = new HM_Backup();
|
29 |
-
$this->backup->set_root( dirname( __FILE__ ) . '/test-data/' );
|
30 |
-
$this->backup->set_path( dirname( __FILE__ ) . '/tmp' );
|
31 |
-
$this->backup->set_type( 'file' );
|
32 |
-
|
33 |
-
mkdir( $this->backup->get_path() );
|
34 |
-
|
35 |
-
$this->symlink = dirname( __FILE__ ) . '/test-data/' . basename( __FILE__ );
|
36 |
-
|
37 |
-
file_put_contents( dirname( __FILE__ ) . '/test-data/symlink', '' );
|
38 |
-
|
39 |
-
symlink( dirname( __FILE__ ) . '/test-data/symlink', $this->symlink );
|
40 |
-
|
41 |
-
unlink( dirname( __FILE__ ) . '/test-data/symlink' );
|
42 |
-
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Cleanup the backup file and tmp directory
|
47 |
-
* after every test
|
48 |
-
*
|
49 |
-
* @access public
|
50 |
-
*/
|
51 |
-
public function tearDown() {
|
52 |
-
|
53 |
-
if ( ! function_exists( 'symlink' ) )
|
54 |
-
return;
|
55 |
-
|
56 |
-
hmbkp_rmdirtree( $this->backup->get_path() );
|
57 |
-
|
58 |
-
unset( $this->backup );
|
59 |
-
|
60 |
-
unlink( $this->symlink );
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Test an unreadable file with the shell commands
|
66 |
-
*
|
67 |
-
* @access public
|
68 |
-
*/
|
69 |
-
public function testArchiveBrokenSymlinkWithZip() {
|
70 |
-
|
71 |
-
if ( ! $this->backup->get_zip_command_path() )
|
72 |
-
$this->markTestSkipped( "Empty zip command path" );
|
73 |
-
|
74 |
-
$this->assertFileNotExists( $this->symlink );
|
75 |
-
$this->assertTrue( is_link( $this->symlink ) );
|
76 |
-
|
77 |
-
$this->backup->zip();
|
78 |
-
|
79 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
80 |
-
|
81 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( basename( $this->symlink ) ) );
|
82 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 3 );
|
83 |
-
|
84 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
85 |
-
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Test an unreadable file with the zipArchive commands
|
90 |
-
*
|
91 |
-
* @access public
|
92 |
-
*/
|
93 |
-
public function testArchiveBrokenSymlinkWithZipArchive() {
|
94 |
-
|
95 |
-
$this->backup->set_zip_command_path( false );
|
96 |
-
|
97 |
-
$this->assertFileNotExists( $this->symlink );
|
98 |
-
$this->assertTrue( is_link( $this->symlink ) );
|
99 |
-
|
100 |
-
$this->backup->zip_archive();
|
101 |
-
|
102 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
103 |
-
|
104 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( basename( $this->symlink ) ) );
|
105 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 3 );
|
106 |
-
|
107 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
108 |
-
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Test an unreadable file with the PclZip commands
|
113 |
-
*
|
114 |
-
* @access public
|
115 |
-
*/
|
116 |
-
public function testArchiveBrokenSymlinkWithPclZip() {
|
117 |
-
|
118 |
-
$this->backup->set_zip_command_path( false );
|
119 |
-
|
120 |
-
$this->assertFileNotExists( $this->symlink );
|
121 |
-
$this->assertTrue( is_link( $this->symlink ) );
|
122 |
-
|
123 |
-
$this->backup->pcl_zip();
|
124 |
-
|
125 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
126 |
-
|
127 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( basename( $this->symlink ) ) );
|
128 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 3 );
|
129 |
-
|
130 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
131 |
-
|
132 |
-
}
|
133 |
-
|
134 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/hm-backup/tests/testConformDir.php
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests that the conform_dir method
|
5 |
-
* properly normalized various combinations of slashes
|
6 |
-
*
|
7 |
-
* @extends WP_UnitTestCase
|
8 |
-
*/
|
9 |
-
class testConformDirTestCase extends WP_UnitTestCase {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* The correct dir
|
13 |
-
*
|
14 |
-
* @var string
|
15 |
-
* @access protected
|
16 |
-
*/
|
17 |
-
protected $dir;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Contains the current backup instance
|
21 |
-
*
|
22 |
-
* @var object
|
23 |
-
* @access protected
|
24 |
-
*/
|
25 |
-
protected $backup;
|
26 |
-
|
27 |
-
public function setUp() {
|
28 |
-
|
29 |
-
$this->backup = new HM_Backup;
|
30 |
-
$this->dir = '/one/two/three';
|
31 |
-
|
32 |
-
}
|
33 |
-
|
34 |
-
public function testBackSlash() {
|
35 |
-
|
36 |
-
$this->assertEquals( HM_Backup::conform_dir( $this->dir ), $this->dir );
|
37 |
-
|
38 |
-
}
|
39 |
-
|
40 |
-
public function testForwardSlash() {
|
41 |
-
|
42 |
-
$this->assertEquals( HM_Backup::conform_dir( '\one\two\three' ), $this->dir );
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
public function testTrailingSlash() {
|
47 |
-
|
48 |
-
$this->assertEquals( HM_Backup::conform_dir( '/one/two/three/' ), $this->dir );
|
49 |
-
|
50 |
-
}
|
51 |
-
|
52 |
-
public function testDoubleBackSlash() {
|
53 |
-
|
54 |
-
$this->assertEquals( HM_Backup::conform_dir( '//one//two//three' ), $this->dir );
|
55 |
-
|
56 |
-
}
|
57 |
-
|
58 |
-
public function testDoubleForwardSlash() {
|
59 |
-
|
60 |
-
$this->assertEquals( HM_Backup::conform_dir( '\\one\\two\\three' ), $this->dir );
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
public function testMixedSlashes() {
|
65 |
-
|
66 |
-
$this->assertEquals( HM_Backup::conform_dir( '\/one\//\two\/\\three' ), $this->dir );
|
67 |
-
|
68 |
-
}
|
69 |
-
|
70 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/hm-backup/tests/testDatabaseDump.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests for the complete backup process both with
|
5 |
-
* the shell commands and with the PHP fallbacks
|
6 |
-
*
|
7 |
-
* @extends WP_UnitTestCase
|
8 |
-
*/
|
9 |
-
class testDatabaseDumpTestCase extends WP_UnitTestCase {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Contains the current backup instance
|
13 |
-
*
|
14 |
-
* @var object
|
15 |
-
* @access protected
|
16 |
-
*/
|
17 |
-
protected $backup;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Setup the backup object and create the tmp directory
|
21 |
-
*
|
22 |
-
* @access public
|
23 |
-
*/
|
24 |
-
public function setUp() {
|
25 |
-
|
26 |
-
$this->backup = new HM_Backup();
|
27 |
-
$this->backup->set_path( dirname( __FILE__ ) . '/tmp' );
|
28 |
-
|
29 |
-
mkdir( $this->backup->get_path() );
|
30 |
-
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Cleanup the backup file and tmp directory
|
35 |
-
* after every test
|
36 |
-
*
|
37 |
-
* @access public
|
38 |
-
*/
|
39 |
-
public function tearDown() {
|
40 |
-
|
41 |
-
hmbkp_rmdirtree( $this->backup->get_path() );
|
42 |
-
|
43 |
-
unset( $this->backup );
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Test a database dump with the zip command
|
49 |
-
*
|
50 |
-
* @access public
|
51 |
-
*/
|
52 |
-
public function testDatabaseDumpWithMysqldump() {
|
53 |
-
|
54 |
-
if ( ! $this->backup->get_mysqldump_command_path() )
|
55 |
-
$this->markTestSkipped( "Empty mysqldump command path" );
|
56 |
-
|
57 |
-
$this->backup->mysqldump();
|
58 |
-
|
59 |
-
$this->assertFileExists( $this->backup->get_database_dump_filepath() );
|
60 |
-
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Test a database dump with the PHP fallback
|
65 |
-
*
|
66 |
-
* @access public
|
67 |
-
*/
|
68 |
-
public function testDatabaseDumpWithFallback() {
|
69 |
-
|
70 |
-
$this->backup->mysqldump_fallback();
|
71 |
-
|
72 |
-
$this->assertFileExists( $this->backup->get_database_dump_filepath() );
|
73 |
-
|
74 |
-
}
|
75 |
-
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/hm-backup/tests/testExcludes.php
DELETED
@@ -1,537 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests for excludes logic of the back up
|
5 |
-
* files process
|
6 |
-
*
|
7 |
-
* @extends WP_UnitTestCase
|
8 |
-
*/
|
9 |
-
class testExcludesTestCase extends WP_UnitTestCase {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Contains the current backup instance
|
13 |
-
*
|
14 |
-
* @var object
|
15 |
-
* @access protected
|
16 |
-
*/
|
17 |
-
protected $backup;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Setup the backup object and create the tmp directory
|
21 |
-
*
|
22 |
-
* @access public
|
23 |
-
*/
|
24 |
-
public function setUp() {
|
25 |
-
|
26 |
-
$this->backup = new HM_Backup();
|
27 |
-
$this->backup->set_root( dirname( __FILE__ ) . '/test-data/' );
|
28 |
-
$this->backup->set_path( dirname( __FILE__ ) . '/tmp' );
|
29 |
-
|
30 |
-
$this->path = $this->backup->get_path();
|
31 |
-
|
32 |
-
mkdir( $this->path );
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Cleanup the backup file and tmp directory
|
38 |
-
* after every test
|
39 |
-
*
|
40 |
-
* @access public
|
41 |
-
*/
|
42 |
-
public function tearDown() {
|
43 |
-
|
44 |
-
hmbkp_rmdirtree( $this->backup->get_path() );
|
45 |
-
|
46 |
-
unset( $this->backup );
|
47 |
-
|
48 |
-
}
|
49 |
-
|
50 |
-
public function testBackUpDirIsExcludedWhenBackUpDirIsNotInRoot() {
|
51 |
-
|
52 |
-
$this->assertNotContains( $this->backup->get_root(), $this->backup->get_path() );
|
53 |
-
|
54 |
-
$this->assertEmpty( $this->backup->get_excludes() );
|
55 |
-
|
56 |
-
}
|
57 |
-
|
58 |
-
public function testBackUpDirIsExcludedWhenBackUpDirIsInRoot() {
|
59 |
-
|
60 |
-
$this->backup->set_path( dirname( __FILE__ ) . '/test-data/tmp' );
|
61 |
-
|
62 |
-
$this->assertContains( $this->backup->get_root(), $this->backup->get_path() );
|
63 |
-
|
64 |
-
$this->assertNotEmpty( $this->backup->get_excludes() );
|
65 |
-
|
66 |
-
$this->assertContains( trailingslashit( $this->backup->get_path() ), $this->backup->get_excludes() );
|
67 |
-
|
68 |
-
}
|
69 |
-
|
70 |
-
public function testExcludeAbsoluteDirPathWithZip() {
|
71 |
-
|
72 |
-
$this->backup->set_excludes( '/exclude/' );
|
73 |
-
$this->backup->set_type( 'file' );
|
74 |
-
|
75 |
-
if ( ! $this->backup->get_zip_command_path() )
|
76 |
-
$this->markTestSkipped( "Empty zip command path" );
|
77 |
-
|
78 |
-
$this->backup->zip();
|
79 |
-
|
80 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
81 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 1 );
|
82 |
-
|
83 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
84 |
-
|
85 |
-
}
|
86 |
-
|
87 |
-
public function testExcludeAbsoluteDirPathWithPclZip() {
|
88 |
-
|
89 |
-
$this->backup->set_excludes( '/exclude/' );
|
90 |
-
$this->backup->set_type( 'file' );
|
91 |
-
|
92 |
-
$this->backup->pcl_zip();
|
93 |
-
|
94 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
95 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 1 );
|
96 |
-
|
97 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
98 |
-
|
99 |
-
}
|
100 |
-
|
101 |
-
public function testExcludeAbsoluteRootDirPathWithZip() {
|
102 |
-
|
103 |
-
$this->backup->set_excludes( dirname( __FILE__ ) . '/test-data/exclude/' );
|
104 |
-
$this->backup->set_type( 'file' );
|
105 |
-
|
106 |
-
if ( ! $this->backup->get_zip_command_path() )
|
107 |
-
$this->markTestSkipped( "Empty zip command path" );
|
108 |
-
|
109 |
-
$this->backup->zip();
|
110 |
-
|
111 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
112 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 1 );
|
113 |
-
|
114 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
115 |
-
|
116 |
-
}
|
117 |
-
|
118 |
-
public function testExcludeAbsoluteRootDirPathWithPclZip() {
|
119 |
-
|
120 |
-
$this->backup->set_excludes( dirname( __FILE__ ) . '/test-data/exclude/' );
|
121 |
-
$this->backup->set_type( 'file' );
|
122 |
-
|
123 |
-
$this->backup->pcl_zip();
|
124 |
-
|
125 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
126 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 1 );
|
127 |
-
|
128 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
129 |
-
|
130 |
-
}
|
131 |
-
|
132 |
-
public function testExcludeDirPathFragmentWithZip() {
|
133 |
-
|
134 |
-
$this->backup->set_excludes( 'exclude/' );
|
135 |
-
$this->backup->set_type( 'file' );
|
136 |
-
|
137 |
-
if ( ! $this->backup->get_zip_command_path() )
|
138 |
-
$this->markTestSkipped( "Empty zip command path" );
|
139 |
-
|
140 |
-
$this->backup->zip();
|
141 |
-
|
142 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
143 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 1 );
|
144 |
-
|
145 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
146 |
-
|
147 |
-
}
|
148 |
-
|
149 |
-
public function testExcludeDirPathFragmentWithPclZip() {
|
150 |
-
|
151 |
-
$this->backup->set_excludes( 'exclude/' );
|
152 |
-
$this->backup->set_type( 'file' );
|
153 |
-
|
154 |
-
$this->backup->pcl_zip();
|
155 |
-
|
156 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
157 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 1 );
|
158 |
-
|
159 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
160 |
-
|
161 |
-
}
|
162 |
-
|
163 |
-
public function testExcludeAmbiguousAbsoluteDirPathWithZip() {
|
164 |
-
|
165 |
-
$this->backup->set_excludes( 'exclude' );
|
166 |
-
$this->backup->set_type( 'file' );
|
167 |
-
|
168 |
-
if ( ! $this->backup->get_zip_command_path() )
|
169 |
-
$this->markTestSkipped( "Empty zip command path" );
|
170 |
-
|
171 |
-
$this->backup->zip();
|
172 |
-
|
173 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
174 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 1 );
|
175 |
-
|
176 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
177 |
-
|
178 |
-
}
|
179 |
-
|
180 |
-
public function testExcludeAmbiguousAbsoluteDirPathWithPclZip() {
|
181 |
-
|
182 |
-
$this->backup->set_excludes( 'exclude' );
|
183 |
-
$this->backup->set_type( 'file' );
|
184 |
-
|
185 |
-
$this->backup->pcl_zip();
|
186 |
-
|
187 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
188 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 1 );
|
189 |
-
|
190 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
191 |
-
|
192 |
-
}
|
193 |
-
|
194 |
-
public function testExcludeAbsoluteFilePathWithZip() {
|
195 |
-
|
196 |
-
$this->backup->set_excludes( '/exclude/exclude.exclude' );
|
197 |
-
$this->backup->set_type( 'file' );
|
198 |
-
|
199 |
-
if ( ! $this->backup->get_zip_command_path() )
|
200 |
-
$this->markTestSkipped( "Empty zip command path" );
|
201 |
-
|
202 |
-
$this->backup->zip();
|
203 |
-
|
204 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
205 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
206 |
-
|
207 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
208 |
-
|
209 |
-
}
|
210 |
-
|
211 |
-
public function testExcludeAbsoluteFilePathWithPclZip() {
|
212 |
-
|
213 |
-
$this->backup->set_excludes( '/exclude/exclude.exclude' );
|
214 |
-
$this->backup->set_type( 'file' );
|
215 |
-
|
216 |
-
$this->backup->pcl_zip();
|
217 |
-
|
218 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
219 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
220 |
-
|
221 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
222 |
-
|
223 |
-
}
|
224 |
-
|
225 |
-
public function testExcludeAmbiguousAbsoluteFilePathWithZip() {
|
226 |
-
|
227 |
-
$this->backup->set_excludes( 'exclude/exclude.exclude' );
|
228 |
-
$this->backup->set_type( 'file' );
|
229 |
-
|
230 |
-
if ( ! $this->backup->get_zip_command_path() )
|
231 |
-
$this->markTestSkipped( "Empty zip command path" );
|
232 |
-
|
233 |
-
$this->backup->zip();
|
234 |
-
|
235 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
236 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
237 |
-
|
238 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
239 |
-
|
240 |
-
}
|
241 |
-
|
242 |
-
public function testExcludeAmbiguousAbsoluteFilePathWithPclZip() {
|
243 |
-
|
244 |
-
$this->backup->set_excludes( 'exclude/exclude.exclude' );
|
245 |
-
$this->backup->set_type( 'file' );
|
246 |
-
|
247 |
-
$this->backup->pcl_zip();
|
248 |
-
|
249 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
250 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
251 |
-
|
252 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
253 |
-
|
254 |
-
}
|
255 |
-
|
256 |
-
public function testExcludeAbsolutePathWithWildcardFileWithZip() {
|
257 |
-
|
258 |
-
$this->backup->set_excludes( '/exclude/*' );
|
259 |
-
$this->backup->set_type( 'file' );
|
260 |
-
|
261 |
-
if ( ! $this->backup->get_zip_command_path() )
|
262 |
-
$this->markTestSkipped( "Empty zip command path" );
|
263 |
-
|
264 |
-
$this->backup->zip();
|
265 |
-
|
266 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
267 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
268 |
-
|
269 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
270 |
-
|
271 |
-
}
|
272 |
-
|
273 |
-
public function testExcludeAbsolutePathWithWildcardFileWithPclZip() {
|
274 |
-
|
275 |
-
$this->backup->set_excludes( '/exclude/*' );
|
276 |
-
$this->backup->set_type( 'file' );
|
277 |
-
|
278 |
-
$this->backup->pcl_zip();
|
279 |
-
|
280 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
281 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
282 |
-
|
283 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
284 |
-
|
285 |
-
}
|
286 |
-
|
287 |
-
public function testExcludeAmbiguousAbsolutePathWithWildcardFileWithZip() {
|
288 |
-
|
289 |
-
$this->backup->set_excludes( 'exclude/*' );
|
290 |
-
$this->backup->set_type( 'file' );
|
291 |
-
|
292 |
-
if ( ! $this->backup->get_zip_command_path() )
|
293 |
-
$this->markTestSkipped( "Empty zip command path" );
|
294 |
-
|
295 |
-
$this->backup->pcl_zip();
|
296 |
-
|
297 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
298 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
299 |
-
|
300 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
301 |
-
|
302 |
-
}
|
303 |
-
|
304 |
-
public function testExcludeAmbiguousAbsolutePathWithWildcardFileWithPclZip() {
|
305 |
-
|
306 |
-
$this->backup->set_excludes( 'exclude/*' );
|
307 |
-
$this->backup->set_type( 'file' );
|
308 |
-
|
309 |
-
$this->backup->pcl_zip();
|
310 |
-
|
311 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
312 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
313 |
-
|
314 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
315 |
-
|
316 |
-
}
|
317 |
-
|
318 |
-
public function testExcludeWildcardFileNameWithZip() {
|
319 |
-
|
320 |
-
$this->backup->set_excludes( '*.exclude' );
|
321 |
-
$this->backup->set_type( 'file' );
|
322 |
-
|
323 |
-
if ( ! $this->backup->get_zip_command_path() )
|
324 |
-
$this->markTestSkipped( "Empty zip command path" );
|
325 |
-
|
326 |
-
$this->backup->zip();
|
327 |
-
|
328 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
329 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
330 |
-
|
331 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
332 |
-
|
333 |
-
}
|
334 |
-
|
335 |
-
public function testExcludeWildcardFileNameWithPclZip() {
|
336 |
-
|
337 |
-
$this->backup->set_excludes( '*.exclude' );
|
338 |
-
$this->backup->set_type( 'file' );
|
339 |
-
|
340 |
-
$this->backup->pcl_zip();
|
341 |
-
|
342 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
343 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
344 |
-
|
345 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
346 |
-
|
347 |
-
}
|
348 |
-
|
349 |
-
public function testExcludeAbsolutePathWithWildcardFileNameWithZip() {
|
350 |
-
|
351 |
-
$this->backup->set_excludes( '/exclude/*.exclude' );
|
352 |
-
$this->backup->set_type( 'file' );
|
353 |
-
|
354 |
-
if ( ! $this->backup->get_zip_command_path() )
|
355 |
-
$this->markTestSkipped( "Empty zip command path" );
|
356 |
-
|
357 |
-
$this->backup->zip();
|
358 |
-
|
359 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
360 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
361 |
-
|
362 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
363 |
-
|
364 |
-
}
|
365 |
-
|
366 |
-
public function testExcludeAbsolutePathWithWildcardFileNameWithPclZip() {
|
367 |
-
|
368 |
-
$this->backup->set_excludes( '/exclude/*.exclude' );
|
369 |
-
$this->backup->set_type( 'file' );
|
370 |
-
|
371 |
-
$this->backup->pcl_zip();
|
372 |
-
|
373 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
374 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
375 |
-
|
376 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
377 |
-
|
378 |
-
}
|
379 |
-
|
380 |
-
public function testExcludeAmbiguousAbsolutePathWithWildcardFileNameWithZip() {
|
381 |
-
|
382 |
-
$this->backup->set_excludes( 'exclude/*.exclude' );
|
383 |
-
$this->backup->set_type( 'file' );
|
384 |
-
|
385 |
-
if ( ! $this->backup->get_zip_command_path() )
|
386 |
-
$this->markTestSkipped( "Empty zip command path" );
|
387 |
-
|
388 |
-
$this->backup->zip();
|
389 |
-
|
390 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
391 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
392 |
-
|
393 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
394 |
-
|
395 |
-
}
|
396 |
-
|
397 |
-
public function testExcludeAmbiguousAbsolutePathWithWildcardFileNameWithPclZip() {
|
398 |
-
|
399 |
-
$this->backup->set_excludes( 'exclude/*.exclude' );
|
400 |
-
$this->backup->set_type( 'file' );
|
401 |
-
|
402 |
-
$this->backup->pcl_zip();
|
403 |
-
|
404 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
405 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
406 |
-
|
407 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
408 |
-
|
409 |
-
}
|
410 |
-
|
411 |
-
public function testExcludeWildcardFileExtensionWithZip() {
|
412 |
-
|
413 |
-
$this->backup->set_excludes( 'exclude.*' );
|
414 |
-
$this->backup->set_type( 'file' );
|
415 |
-
|
416 |
-
if ( ! $this->backup->get_zip_command_path() )
|
417 |
-
$this->markTestSkipped( "Empty zip command path" );
|
418 |
-
|
419 |
-
$this->backup->zip();
|
420 |
-
|
421 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
422 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
423 |
-
|
424 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
425 |
-
|
426 |
-
}
|
427 |
-
|
428 |
-
public function testExcludeWildcardFileExtensionWithPclZip() {
|
429 |
-
|
430 |
-
$this->backup->set_excludes( 'exclude.*' );
|
431 |
-
$this->backup->set_type( 'file' );
|
432 |
-
|
433 |
-
$this->backup->pcl_zip();
|
434 |
-
|
435 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
436 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
437 |
-
|
438 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
439 |
-
|
440 |
-
}
|
441 |
-
|
442 |
-
public function testExcludeAbsolutePathWithWildcardFileExtensionWithZip() {
|
443 |
-
|
444 |
-
$this->backup->set_excludes( '/exclude/exclude.*' );
|
445 |
-
$this->backup->set_type( 'file' );
|
446 |
-
|
447 |
-
if ( ! $this->backup->get_zip_command_path() )
|
448 |
-
$this->markTestSkipped( "Empty zip command path" );
|
449 |
-
|
450 |
-
$this->backup->zip();
|
451 |
-
|
452 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
453 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
454 |
-
|
455 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
456 |
-
|
457 |
-
}
|
458 |
-
|
459 |
-
public function testExcludeAbsolutePathWithWildcardFileExtensionWithPclZip() {
|
460 |
-
|
461 |
-
$this->backup->set_excludes( '/exclude/exclude.*' );
|
462 |
-
$this->backup->set_type( 'file' );
|
463 |
-
|
464 |
-
$this->backup->pcl_zip();
|
465 |
-
|
466 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
467 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
468 |
-
|
469 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
470 |
-
|
471 |
-
}
|
472 |
-
|
473 |
-
public function testExcludeAmbiguousAbsolutePathWithWildcardFileExtensionWithZip() {
|
474 |
-
|
475 |
-
$this->backup->set_excludes( 'exclude/exclude.*' );
|
476 |
-
$this->backup->set_type( 'file' );
|
477 |
-
|
478 |
-
if ( ! $this->backup->get_zip_command_path() )
|
479 |
-
$this->markTestSkipped( "Empty zip command path" );
|
480 |
-
|
481 |
-
$this->backup->zip();
|
482 |
-
|
483 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
484 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
485 |
-
|
486 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
487 |
-
|
488 |
-
}
|
489 |
-
|
490 |
-
public function testExcludeAmbiguousAbsolutePathWithWildcardFileExtensionWithPclZip() {
|
491 |
-
|
492 |
-
$this->backup->set_excludes( 'exclude/exclude.*' );
|
493 |
-
$this->backup->set_type( 'file' );
|
494 |
-
|
495 |
-
$this->backup->pcl_zip();
|
496 |
-
|
497 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'exclude/exclude.exclude' ) );
|
498 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
499 |
-
|
500 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
501 |
-
|
502 |
-
}
|
503 |
-
|
504 |
-
public function testWildCardWithZip() {
|
505 |
-
|
506 |
-
$this->backup->set_excludes( '*' );
|
507 |
-
$this->backup->set_type( 'file' );
|
508 |
-
|
509 |
-
if ( ! $this->backup->get_zip_command_path() )
|
510 |
-
$this->markTestSkipped( "Empty zip command path" );
|
511 |
-
|
512 |
-
$this->backup->zip();
|
513 |
-
|
514 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 0 );
|
515 |
-
|
516 |
-
// Expect an error "Nothing to do"
|
517 |
-
$this->assertNotEmpty( $this->backup->get_errors() );
|
518 |
-
|
519 |
-
}
|
520 |
-
|
521 |
-
public function testWildCardWithPclZip() {
|
522 |
-
|
523 |
-
$this->backup->set_excludes( '*' );
|
524 |
-
$this->backup->set_type( 'file' );
|
525 |
-
|
526 |
-
if ( ! $this->backup->get_zip_command_path() )
|
527 |
-
$this->markTestSkipped( "Empty zip command path" );
|
528 |
-
|
529 |
-
$this->backup->pcl_zip();
|
530 |
-
|
531 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 0 );
|
532 |
-
|
533 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
534 |
-
|
535 |
-
}
|
536 |
-
|
537 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/hm-backup/tests/testSymlinkDir.php
DELETED
@@ -1,128 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests for the Archive process with symlinks
|
5 |
-
*
|
6 |
-
* @extends WP_UnitTestCase
|
7 |
-
*/
|
8 |
-
class testSymlinkDirTestCase extends WP_UnitTestCase {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Contains the current backup instance
|
12 |
-
*
|
13 |
-
* @var object
|
14 |
-
* @access protected
|
15 |
-
*/
|
16 |
-
protected $backup;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Setup the backup object and create the tmp directory
|
20 |
-
*
|
21 |
-
* @access public
|
22 |
-
*/
|
23 |
-
public function setUp() {
|
24 |
-
|
25 |
-
if ( ! function_exists( 'symlink' ) )
|
26 |
-
$this->markTestSkipped( 'symlink function not defined' );
|
27 |
-
|
28 |
-
$this->backup = new HM_Backup();
|
29 |
-
$this->backup->set_root( dirname( __FILE__ ) . '/test-data/' );
|
30 |
-
$this->backup->set_path( dirname( __FILE__ ) . '/tmp' );
|
31 |
-
$this->backup->set_type( 'file' );
|
32 |
-
|
33 |
-
mkdir( $this->backup->get_path() );
|
34 |
-
|
35 |
-
$this->symlink = dirname( __FILE__ ) . '/test-data/tests';
|
36 |
-
|
37 |
-
symlink( trailingslashit( HMBKP_PLUGIN_PATH ) . 'tests/', $this->symlink );
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Cleanup the backup file and tmp directory
|
43 |
-
* after every test
|
44 |
-
*
|
45 |
-
* @access public
|
46 |
-
*/
|
47 |
-
public function tearDown() {
|
48 |
-
|
49 |
-
if ( ! function_exists( 'symlink' ) )
|
50 |
-
return;
|
51 |
-
|
52 |
-
hmbkp_rmdirtree( $this->backup->get_path() );
|
53 |
-
|
54 |
-
unset( $this->backup );
|
55 |
-
|
56 |
-
if ( file_exists( $this->symlink ) )
|
57 |
-
unlink( $this->symlink );
|
58 |
-
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Test an unreadable file with the shell commands
|
63 |
-
*
|
64 |
-
* @access public
|
65 |
-
*/
|
66 |
-
public function testArchiveSymlinkDirWithZip() {
|
67 |
-
|
68 |
-
if ( ! $this->backup->get_zip_command_path() )
|
69 |
-
$this->markTestSkipped( "Empty zip command path" );
|
70 |
-
|
71 |
-
$this->assertFileExists( $this->symlink );
|
72 |
-
|
73 |
-
$this->backup->zip();
|
74 |
-
|
75 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
76 |
-
|
77 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( basename( $this->symlink ) ) );
|
78 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 8 );
|
79 |
-
|
80 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
81 |
-
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Test an unreadable file with the zipArchive commands
|
86 |
-
*
|
87 |
-
* @access public
|
88 |
-
*/
|
89 |
-
public function testArchiveSymlinkDirWithZipArchive() {
|
90 |
-
|
91 |
-
$this->backup->set_zip_command_path( false );
|
92 |
-
|
93 |
-
$this->assertFileExists( $this->symlink );
|
94 |
-
|
95 |
-
$this->backup->zip_archive();
|
96 |
-
|
97 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
98 |
-
|
99 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( basename( $this->symlink ) ) );
|
100 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 8 );
|
101 |
-
|
102 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
103 |
-
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Test an unreadable file with the PclZip commands
|
108 |
-
*
|
109 |
-
* @access public
|
110 |
-
*/
|
111 |
-
public function testArchiveSymlinkDirWithPclZip() {
|
112 |
-
|
113 |
-
$this->backup->set_zip_command_path( false );
|
114 |
-
|
115 |
-
$this->assertFileExists( $this->symlink );
|
116 |
-
|
117 |
-
$this->backup->pcl_zip();
|
118 |
-
|
119 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
120 |
-
|
121 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( basename( $this->symlink ) ) );
|
122 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 8 );
|
123 |
-
|
124 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
125 |
-
|
126 |
-
}
|
127 |
-
|
128 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/hm-backup/tests/testSymlinkFile.php
DELETED
@@ -1,128 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests for the Archive process with symlinks
|
5 |
-
*
|
6 |
-
* @extends WP_UnitTestCase
|
7 |
-
*/
|
8 |
-
class testSymlinkFileTestCase extends WP_UnitTestCase {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Contains the current backup instance
|
12 |
-
*
|
13 |
-
* @var object
|
14 |
-
* @access protected
|
15 |
-
*/
|
16 |
-
protected $backup;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Setup the backup object and create the tmp directory
|
20 |
-
*
|
21 |
-
* @access public
|
22 |
-
*/
|
23 |
-
public function setUp() {
|
24 |
-
|
25 |
-
if ( ! function_exists( 'symlink' ) )
|
26 |
-
$this->markTestSkipped( 'symlink function not defined' );
|
27 |
-
|
28 |
-
$this->backup = new HM_Backup();
|
29 |
-
$this->backup->set_root( dirname( __FILE__ ) . '/test-data/' );
|
30 |
-
$this->backup->set_path( dirname( __FILE__ ) . '/tmp' );
|
31 |
-
$this->backup->set_type( 'file' );
|
32 |
-
|
33 |
-
mkdir( $this->backup->get_path() );
|
34 |
-
|
35 |
-
$this->symlink = dirname( __FILE__ ) . '/test-data/' . basename( __FILE__ );
|
36 |
-
|
37 |
-
symlink( __FILE__, $this->symlink );
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Cleanup the backup file and tmp directory
|
43 |
-
* after every test
|
44 |
-
*
|
45 |
-
* @access public
|
46 |
-
*/
|
47 |
-
public function tearDown() {
|
48 |
-
|
49 |
-
if ( ! function_exists( 'symlink' ) )
|
50 |
-
return;
|
51 |
-
|
52 |
-
hmbkp_rmdirtree( $this->backup->get_path() );
|
53 |
-
|
54 |
-
unset( $this->backup );
|
55 |
-
|
56 |
-
if ( file_exists( $this->symlink ) )
|
57 |
-
unlink( $this->symlink );
|
58 |
-
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Test an unreadable file with the shell commands
|
63 |
-
*
|
64 |
-
* @access public
|
65 |
-
*/
|
66 |
-
public function testArchiveSymlinkFileWithZip() {
|
67 |
-
|
68 |
-
if ( ! $this->backup->get_zip_command_path() )
|
69 |
-
$this->markTestSkipped( "Empty zip command path" );
|
70 |
-
|
71 |
-
$this->assertFileExists( $this->symlink );
|
72 |
-
|
73 |
-
$this->backup->zip();
|
74 |
-
|
75 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
76 |
-
|
77 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( basename( $this->symlink ) ) );
|
78 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 4 );
|
79 |
-
|
80 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
81 |
-
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Test an unreadable file with the zipArchive commands
|
86 |
-
*
|
87 |
-
* @access public
|
88 |
-
*/
|
89 |
-
public function testArchiveSymlinkFileWithZipArchive() {
|
90 |
-
|
91 |
-
$this->backup->set_zip_command_path( false );
|
92 |
-
|
93 |
-
$this->assertFileExists( $this->symlink );
|
94 |
-
|
95 |
-
$this->backup->zip_archive();
|
96 |
-
|
97 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
98 |
-
|
99 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( basename( $this->symlink ) ) );
|
100 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 4 );
|
101 |
-
|
102 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
103 |
-
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Test an unreadable file with the PclZip commands
|
108 |
-
*
|
109 |
-
* @access public
|
110 |
-
*/
|
111 |
-
public function testArchiveSymlinkFileWithPclZip() {
|
112 |
-
|
113 |
-
$this->backup->set_zip_command_path( false );
|
114 |
-
|
115 |
-
$this->assertFileExists( $this->symlink );
|
116 |
-
|
117 |
-
$this->backup->pcl_zip();
|
118 |
-
|
119 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
120 |
-
|
121 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), array( basename( $this->symlink ) ) );
|
122 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 4 );
|
123 |
-
|
124 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
125 |
-
|
126 |
-
}
|
127 |
-
|
128 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/hm-backup/tests/testUnreadableFile.php
DELETED
@@ -1,121 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests for the Archive process with unreadble files
|
5 |
-
*
|
6 |
-
* @extends WP_UnitTestCase
|
7 |
-
*/
|
8 |
-
class testUnreadableFileTestCase extends WP_UnitTestCase {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Contains the current backup instance
|
12 |
-
*
|
13 |
-
* @var object
|
14 |
-
* @access protected
|
15 |
-
*/
|
16 |
-
protected $backup;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Setup the backup object and create the tmp directory
|
20 |
-
*
|
21 |
-
* @access public
|
22 |
-
*/
|
23 |
-
public function setUp() {
|
24 |
-
|
25 |
-
$this->backup = new HM_Backup();
|
26 |
-
$this->backup->set_root( dirname( __FILE__ ) . '/test-data/' );
|
27 |
-
$this->backup->set_path( dirname( __FILE__ ) . '/tmp' );
|
28 |
-
$this->backup->set_type( 'file' );
|
29 |
-
|
30 |
-
mkdir( $this->backup->get_path() );
|
31 |
-
|
32 |
-
chmod( $this->backup->get_root() . '/test-data.txt', 0220 );
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Cleanup the backup file and tmp directory
|
38 |
-
* after every test
|
39 |
-
*
|
40 |
-
* @access public
|
41 |
-
*/
|
42 |
-
public function tearDown() {
|
43 |
-
|
44 |
-
hmbkp_rmdirtree( $this->backup->get_path() );
|
45 |
-
|
46 |
-
chmod( $this->backup->get_root() . '/test-data.txt', 0664 );
|
47 |
-
|
48 |
-
unset( $this->backup );
|
49 |
-
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Test an unreadable file with the shell commands
|
54 |
-
*
|
55 |
-
* @access public
|
56 |
-
*/
|
57 |
-
public function testArchiveUnreadableFileWithZip() {
|
58 |
-
|
59 |
-
if ( ! $this->backup->get_zip_command_path() )
|
60 |
-
$this->markTestSkipped( "Empty zip command path" );
|
61 |
-
|
62 |
-
$this->assertFalse( is_readable( $this->backup->get_root() . '/test-data.txt' ) );
|
63 |
-
|
64 |
-
$this->backup->zip();
|
65 |
-
|
66 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
67 |
-
|
68 |
-
$this->assertNotEmpty( $this->backup->get_warnings() );
|
69 |
-
|
70 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
71 |
-
|
72 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'test-data.txt' ) );
|
73 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
74 |
-
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Test an unreadable file with the zipArchive commands
|
79 |
-
*
|
80 |
-
* @access public
|
81 |
-
*/
|
82 |
-
public function testArchiveUnreadableFileWithZipArchive() {
|
83 |
-
|
84 |
-
$this->backup->set_zip_command_path( false );
|
85 |
-
|
86 |
-
$this->assertFalse( is_readable( $this->backup->get_root() . '/test-data.txt' ) );
|
87 |
-
|
88 |
-
$this->backup->zip_archive();
|
89 |
-
|
90 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
91 |
-
|
92 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
93 |
-
|
94 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'test-data.txt' ) );
|
95 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
96 |
-
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Test an unreadable file with the PclZip commands
|
101 |
-
*
|
102 |
-
* @access public
|
103 |
-
*/
|
104 |
-
public function testArchiveUnreadableFileWithPclZip() {
|
105 |
-
|
106 |
-
$this->backup->set_zip_command_path( false );
|
107 |
-
|
108 |
-
$this->assertFalse( is_readable( $this->backup->get_root() . '/test-data.txt' ) );
|
109 |
-
|
110 |
-
$this->backup->pcl_zip();
|
111 |
-
|
112 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
113 |
-
|
114 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
115 |
-
|
116 |
-
$this->assertArchiveNotContains( $this->backup->get_archive_filepath(), array( 'test-data.txt' ) );
|
117 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), 2 );
|
118 |
-
|
119 |
-
}
|
120 |
-
|
121 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/tests/testFullBackup.php
DELETED
@@ -1,129 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests for the complete backup process both with
|
5 |
-
* the shell commands and with the PHP fallbacks
|
6 |
-
*
|
7 |
-
* @extends WP_UnitTestCase
|
8 |
-
*/
|
9 |
-
class testFullBackUpTestCase extends WP_UnitTestCase {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Contains the current backup instance
|
13 |
-
*
|
14 |
-
* @var object
|
15 |
-
* @access protected
|
16 |
-
*/
|
17 |
-
protected $backup;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Setup the backup object and create the tmp directory
|
21 |
-
*
|
22 |
-
* @access public
|
23 |
-
*/
|
24 |
-
public function setUp() {
|
25 |
-
|
26 |
-
$this->backup = new HM_Backup();
|
27 |
-
$this->backup->set_excludes( '.git/' );
|
28 |
-
|
29 |
-
if ( defined( 'HMBKP_PATH' ) )
|
30 |
-
$this->markTestSkipped( 'Skipped because of defines' );
|
31 |
-
|
32 |
-
hmbkp_rmdirtree( hmbkp_path() );
|
33 |
-
|
34 |
-
hmbkp_path();
|
35 |
-
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Cleanup the backup file and tmp directory
|
40 |
-
* after every test
|
41 |
-
*
|
42 |
-
* @access public
|
43 |
-
*/
|
44 |
-
public function tearDown() {
|
45 |
-
|
46 |
-
hmbkp_rmdirtree( hmbkp_path() );
|
47 |
-
|
48 |
-
unset( $this->backup );
|
49 |
-
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Test a full backup with the shell commands
|
54 |
-
*
|
55 |
-
* @access public
|
56 |
-
*/
|
57 |
-
public function testFullBackupWithZip() {
|
58 |
-
|
59 |
-
if ( ! $this->backup->get_zip_command_path() )
|
60 |
-
$this->markTestSkipped( 'Empty zip command path' );
|
61 |
-
|
62 |
-
$this->backup->backup();
|
63 |
-
|
64 |
-
$this->assertEquals( $this->backup->get_archive_method(), 'zip' );
|
65 |
-
|
66 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
67 |
-
|
68 |
-
$files = $this->backup->get_included_files();
|
69 |
-
$files[] = $this->backup->get_database_dump_filename();
|
70 |
-
|
71 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), $files, $this->backup->get_root() );
|
72 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), count( $files ) );
|
73 |
-
|
74 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
75 |
-
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Test a full backup with the ZipArchive
|
80 |
-
*
|
81 |
-
* @access public
|
82 |
-
*/
|
83 |
-
public function testFullBackupWithZipArchive() {
|
84 |
-
|
85 |
-
$this->backup->set_zip_command_path( false );
|
86 |
-
|
87 |
-
$this->backup->backup();
|
88 |
-
|
89 |
-
$this->assertEquals( $this->backup->get_archive_method(), 'ziparchive' );
|
90 |
-
|
91 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
92 |
-
|
93 |
-
$files = $this->backup->get_included_files();
|
94 |
-
$files[] = $this->backup->get_database_dump_filename();
|
95 |
-
|
96 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), $files, $this->backup->get_root() );
|
97 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), count( $files ) );
|
98 |
-
|
99 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
100 |
-
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Test a full backup with PclZip
|
105 |
-
*
|
106 |
-
* @access public
|
107 |
-
*/
|
108 |
-
public function testFullBackupWithPclZip() {
|
109 |
-
|
110 |
-
$this->backup->set_zip_command_path( false );
|
111 |
-
$this->backup->skip_zip_archive = true;
|
112 |
-
|
113 |
-
$this->backup->backup();
|
114 |
-
|
115 |
-
$this->assertEquals( $this->backup->get_archive_method(), 'pclzip' );
|
116 |
-
|
117 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
118 |
-
|
119 |
-
$files = $this->backup->get_included_files();
|
120 |
-
$files[] = $this->backup->get_database_dump_filename();
|
121 |
-
|
122 |
-
$this->assertArchiveContains( $this->backup->get_archive_filepath(), $files, $this->backup->get_root() );
|
123 |
-
$this->assertArchiveFileCount( $this->backup->get_archive_filepath(), count( $files ) );
|
124 |
-
|
125 |
-
$this->assertEmpty( $this->backup->get_errors() );
|
126 |
-
|
127 |
-
}
|
128 |
-
|
129 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/tests/testImport.php
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Import the HM Backup unit tests
|
4 |
-
foreach ( glob( dirname( dirname( __FILE__ ) ) . '/hm-backup/tests/*.php' ) as $filename )
|
5 |
-
include ( $filename );
|
|
|
|
|
|
|
|
|
|
backupwordpress/tests/testMoveBackupPath.php
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests for moving the backup path if it changes
|
5 |
-
*
|
6 |
-
* @extends WP_UnitTestCase
|
7 |
-
*/
|
8 |
-
class testMoveBackUpPathTestCase extends WP_UnitTestCase {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Contains the current backup instance
|
12 |
-
*
|
13 |
-
* @var object
|
14 |
-
* @access protected
|
15 |
-
*/
|
16 |
-
protected $backup;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Setup the backup object and create the tmp directory
|
20 |
-
*
|
21 |
-
* @access public
|
22 |
-
*/
|
23 |
-
public function setUp() {
|
24 |
-
|
25 |
-
$this->backup = new HM_Backup();
|
26 |
-
$this->backup->set_type( 'database' );
|
27 |
-
|
28 |
-
// Remove the backup directory if it exists
|
29 |
-
hmbkp_rmdirtree( hmbkp_path() );
|
30 |
-
|
31 |
-
$this->custom_path = trailingslashit( WP_CONTENT_DIR ) . 'test-custom';
|
32 |
-
|
33 |
-
hmbkp_rmdirtree( $this->custom_path );
|
34 |
-
|
35 |
-
$this->backup->set_path( hmbkp_path() );
|
36 |
-
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Cleanup the backup file and tmp directory
|
41 |
-
* after every test
|
42 |
-
*
|
43 |
-
* @access public
|
44 |
-
*/
|
45 |
-
public function tearDown() {
|
46 |
-
|
47 |
-
hmbkp_rmdirtree( $this->custom_path );
|
48 |
-
|
49 |
-
delete_option( 'hmbkp_path' );
|
50 |
-
|
51 |
-
hmbkp_rmdirtree( hmbkp_path() );
|
52 |
-
|
53 |
-
unset( $this->backup );
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
|
58 |
-
/**
|
59 |
-
* If the option is updated directly it should be overritten with the default path immediately, nothing should be moved.
|
60 |
-
*
|
61 |
-
* @access public
|
62 |
-
* @return void
|
63 |
-
*/
|
64 |
-
public function testUpdateOptionBackupPath() {
|
65 |
-
|
66 |
-
$this->backup->backup();
|
67 |
-
|
68 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
69 |
-
|
70 |
-
update_option( 'hmbkp_path', $this->custom_path );
|
71 |
-
|
72 |
-
hmbkp_constant_changes();
|
73 |
-
|
74 |
-
$this->assertEquals( hmbkp_path(), hmbkp_path_default() );
|
75 |
-
|
76 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
77 |
-
|
78 |
-
}
|
79 |
-
|
80 |
-
|
81 |
-
/**
|
82 |
-
* If the HMBKP_PATH constant is removed then the path should revert to default and everything should be moved.
|
83 |
-
*
|
84 |
-
* @access public
|
85 |
-
* @return void
|
86 |
-
*/
|
87 |
-
public function testRemovedDefinedBackupPath() {
|
88 |
-
|
89 |
-
update_option( 'hmbkp_path', $this->custom_path );
|
90 |
-
$this->backup->set_path( hmbkp_path() );
|
91 |
-
|
92 |
-
$this->backup->backup();
|
93 |
-
|
94 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
95 |
-
|
96 |
-
hmbkp_constant_changes();
|
97 |
-
|
98 |
-
$this->assertFileNotExists( $this->backup->get_archive_filepath() );
|
99 |
-
$this->assertFileExists( str_replace( $this->backup->get_path(), hmbkp_path(), $this->backup->get_archive_filepath() ) );
|
100 |
-
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
-
/**
|
105 |
-
* If the HMBKP_PATH constant is defined and the new directory is writable then everything should be moved there
|
106 |
-
*
|
107 |
-
* @access public
|
108 |
-
* @return void
|
109 |
-
*/
|
110 |
-
public function testWritableDefinedBackupPath() {
|
111 |
-
|
112 |
-
$this->backup->backup();
|
113 |
-
|
114 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
115 |
-
|
116 |
-
define( 'HMBKP_PATH', $this->custom_path );
|
117 |
-
|
118 |
-
hmbkp_constant_changes();
|
119 |
-
|
120 |
-
$this->assertEquals( hmbkp_path(), HMBKP_PATH );
|
121 |
-
$this->assertFileExists( str_replace( $this->backup->get_path(), HMBKP_PATH, $this->backup->get_archive_filepath() ) );
|
122 |
-
$this->assertFileNotExists( $this->backup->get_archive_filepath() );
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* If the HMBKP_PATH constant is defined and the new directory is writable then everything should be moved there
|
128 |
-
*
|
129 |
-
* @access public
|
130 |
-
* @return void
|
131 |
-
*/
|
132 |
-
public function testUnWritableDefinedBackupPath() {
|
133 |
-
|
134 |
-
$this->assertEquals( hmbkp_path(), HMBKP_PATH );
|
135 |
-
|
136 |
-
$this->backup->backup();
|
137 |
-
|
138 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
139 |
-
|
140 |
-
chmod( $this->custom_path, 0555 );
|
141 |
-
|
142 |
-
hmbkp_constant_changes();
|
143 |
-
|
144 |
-
$this->assertEquals( hmbkp_path(), hmbkp_path_default() );
|
145 |
-
|
146 |
-
chmod( $this->custom_path, 0755 );
|
147 |
-
|
148 |
-
$this->assertFileExists( str_replace( $this->backup->get_path(), hmbkp_path_default(), $this->backup->get_archive_filepath() ) );
|
149 |
-
|
150 |
-
// They should both exist because we didn't have permission to remove the old file
|
151 |
-
$this->assertFileExists( $this->backup->get_archive_filepath() );
|
152 |
-
|
153 |
-
}
|
154 |
-
|
155 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupwordpress/tests/testSchedule.php
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Tests for the complete backup process both with
|
5 |
-
* the shell commands and with the PHP fallbacks
|
6 |
-
*
|
7 |
-
* @extends WP_UnitTestCase
|
8 |
-
*/
|
9 |
-
class testScheduleTestCase extends WP_UnitTestCase {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Contains the current backup schedule instance
|
13 |
-
*
|
14 |
-
* @var object
|
15 |
-
* @access protected
|
16 |
-
*/
|
17 |
-
protected $schedule;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Setup the backup object and create the tmp directory
|
21 |
-
*
|
22 |
-
* @access public
|
23 |
-
*/
|
24 |
-
public function setUp() {
|
25 |
-
|
26 |
-
$this->schedule = new HMBKP_Scheduled_Backup( 'unit-test' );
|
27 |
-
|
28 |
-
}
|
29 |
-
|
30 |
-
public function tearDown() {
|
31 |
-
unset( $this->schedule );
|
32 |
-
}
|
33 |
-
|
34 |
-
public function testDefaultReoccurrence() {
|
35 |
-
|
36 |
-
$this->assertEquals( 'manually', $this->schedule->get_reoccurrence() );
|
37 |
-
|
38 |
-
}
|
39 |
-
|
40 |
-
public function testDefaultSchedule() {
|
41 |
-
|
42 |
-
$this->assertEquals( 'manually', $this->schedule->get_reoccurrence() );
|
43 |
-
|
44 |
-
$this->assertEmpty( $this->schedule->get_next_occurrence() );
|
45 |
-
$this->assertEmpty( $this->schedule->get_schedule_start_time() );
|
46 |
-
$this->assertEmpty( $this->schedule->get_interval() );
|
47 |
-
|
48 |
-
$this->assertEquals( $this->schedule->get_schedule_start_time() + $this->schedule->get_interval(), $this->schedule->get_next_occurrence() );
|
49 |
-
|
50 |
-
}
|
51 |
-
|
52 |
-
public function testSetReoccurrence() {
|
53 |
-
|
54 |
-
$this->schedule->set_reoccurrence( 'daily' );
|
55 |
-
|
56 |
-
$this->assertEquals( 'daily', $this->schedule->get_reoccurrence() );
|
57 |
-
|
58 |
-
}
|
59 |
-
|
60 |
-
public function testSetSchedule() {
|
61 |
-
|
62 |
-
$this->schedule->set_reoccurrence( 'daily' );
|
63 |
-
|
64 |
-
$this->assertEquals( 'daily', $this->schedule->get_reoccurrence() );
|
65 |
-
|
66 |
-
$this->assertEquals( $this->schedule->get_schedule_start_time(), $this->schedule->get_next_occurrence() );
|
67 |
-
|
68 |
-
}
|
69 |
-
|
70 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
Plugin Name: WP Remote
|
5 |
Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. <strong>Deactivate to clear your API Key.</strong>
|
6 |
-
Version: 2.4.
|
7 |
Author: Human Made Limited
|
8 |
Author URI: http://hmn.md/
|
9 |
*/
|
3 |
/*
|
4 |
Plugin Name: WP Remote
|
5 |
Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. <strong>Deactivate to clear your API Key.</strong>
|
6 |
+
Version: 2.4.11
|
7 |
Author: Human Made Limited
|
8 |
Author URI: http://hmn.md/
|
9 |
*/
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: humanmade, joehoyle, mattheu, tcrsavage, willmot
|
|
3 |
Tags: wpremote, remote administration, multiple wordpress
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 3.5
|
6 |
-
Stable tag: 2.4.
|
7 |
|
8 |
WP Remote is a free web app that enables you to easily manage all of your WordPress powered sites from one place.
|
9 |
|
@@ -31,6 +31,10 @@ You can email us at support@wpremote.com for support.
|
|
31 |
|
32 |
== Changelog ==
|
33 |
|
|
|
|
|
|
|
|
|
34 |
#### 2.4.9
|
35 |
|
36 |
* Pull in latest BackUpWordPress which fixes a possible Fatal error caused by `url_shorten` being called outside the admin.
|
3 |
Tags: wpremote, remote administration, multiple wordpress
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 3.5
|
6 |
+
Stable tag: 2.4.11
|
7 |
|
8 |
WP Remote is a free web app that enables you to easily manage all of your WordPress powered sites from one place.
|
9 |
|
31 |
|
32 |
== Changelog ==
|
33 |
|
34 |
+
#### 2.4.10 + 2.4.11
|
35 |
+
|
36 |
+
* Plugin release shenaningans.
|
37 |
+
|
38 |
#### 2.4.9
|
39 |
|
40 |
* Pull in latest BackUpWordPress which fixes a possible Fatal error caused by `url_shorten` being called outside the admin.
|