Skip to content
This repository was archived by the owner on Aug 14, 2022. It is now read-only.

Commit 32ebebe

Browse files
committed
Updated to 1.1.7 version
1 parent a7dc53b commit 32ebebe

File tree

7 files changed

+80
-77
lines changed

7 files changed

+80
-77
lines changed

.gitattributes

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ phpmd.xml export-ignore
88
.travis.yml export-ignore
99
.editorconfig export-ignore
1010
.gitattributes export-ignore
11-
.gitignore export-ignore
11+
.gitignore export-ignore
12+
.php_cs.dist export-ignore
13+
CONDUCT.md export-ignore

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## 1.1.7 - 2018-01-06
4+
5+
* The tests were fixed.
6+
7+
* Changes in documentation.
8+
39
## 1.1.6 - 2017-11-08
410

511
* Implemented `PHP Mess Detector` to detect inconsistencies in code styles.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The MIT License (MIT)
22
=====================
33

4-
Copyright (c) `2017` `Josantonius, https://josantonius.com <[email protected]>`
4+
Copyright (c) `2017 - 2018` `Josantonius, https://josantonius.com <[email protected]>`
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in

README-ES.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,10 @@ Ejecutar todas las pruebas anteriores:
242242

243243
## ☑ Tareas pendientes
244244

245-
- [ ] Añadir nueva funcionalidad
246-
- [ ] Mejorar pruebas
247-
- [ ] Mejorar documentación
248-
- [ ] Refactorizar código
245+
- [ ] Añadir nueva funcionalidad.
246+
- [ ] Mejorar pruebas.
247+
- [ ] Mejorar documentación.
248+
- [ ] Refactorizar código para las reglas de estilo de código deshabilitadas. Ver [phpmd.xml](phpmd.xml) y [.php_cs.dist](.php_cs.dist).
249249

250250
## Contribuir
251251

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ Run all previous tests:
243243

244244
## ☑ TODO
245245

246-
- [ ] Add new feature
247-
- [ ] Improve tests
248-
- [ ] Improve documentation
249-
- [ ] Refactor code
246+
- [ ] Add new feature.
247+
- [ ] Improve tests.
248+
- [ ] Improve documentation.
249+
- [ ] Refactor code for disabled code style rules. See [phpmd.xml](phpmd.xml) and [.php_cs.dist](.php_cs.dist).
250250

251251
## Contribute
252252

@@ -273,7 +273,7 @@ This project is licensed under **MIT license**. See the [LICENSE](LICENSE) file
273273

274274
## Copyright
275275

276-
2017 Josantonius, [josantonius.com](https://josantonius.com/)
276+
2017 - 2018 Josantonius, [josantonius.com](https://josantonius.com/)
277277

278278
If you find it useful, let me know :wink:
279279

src/File.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
/**
33
* PHP library for file management.
44
*
5-
* @author Josantonius - [email protected]
6-
* @copyright Copyright (c) 2017
7-
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
8-
* @link https://github.com/Josantonius/PHP-File
9-
* @since 1.0.0
5+
* @author Josantonius <[email protected]>
6+
* @copyright 2017 - 2018 (c) Josantonius - PHP-File
7+
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
8+
* @link https://github.com/Josantonius/PHP-File
9+
* @since 1.0.0
1010
*/
1111
namespace Josantonius\File;
1212

1313
/**
1414
* File handler.
15-
*
16-
* @since 1.0.0
1715
*/
1816
class File
1917
{

tests/FileTest.php

+56-59
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@
22
/**
33
* PHP library for file management.
44
*
5-
* @author Josantonius - [email protected]
6-
* @copyright Copyright (c) 2017
7-
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
8-
* @link https://github.com/Josantonius/PHP-File
9-
* @since 1.1.4
5+
* @author Josantonius <[email protected]>
6+
* @copyright 2017 - 2018 (c) Josantonius - PHP-File
7+
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
8+
* @link https://github.com/Josantonius/PHP-File
9+
* @since 1.1.4
1010
*/
1111
namespace Josantonius\File;
1212

1313
use PHPUnit\Framework\TestCase;
1414

1515
/**
1616
* Tests class for File library.
17-
*
18-
* @since 1.1.4
1917
*/
2018
class FileTest extends TestCase
2119
{
@@ -47,210 +45,209 @@ public function setUp()
4745
*/
4846
public function testIsInstanceOfFile()
4947
{
50-
$actual = $this->File;
51-
$this->assertInstanceOf('Josantonius\File\File', $actual);
48+
$this->assertInstanceOf('Josantonius\File\File', $this->File);
5249
}
5350

5451
/**
5552
* Test if a local file exists.
56-
*
57-
* @since 1.1.4
5853
*/
5954
public function testIfLocalFileExists()
6055
{
56+
$file = $this->File;
57+
6158
$this->assertTrue(
62-
$this->File->exists(__FILE__)
59+
$file::exists(__FILE__)
6360
);
6461
}
6562

6663
/**
6764
* Test if a local file doesn't exists.
68-
*
69-
* @since 1.1.4
7065
*/
7166
public function testIfLocalFileDoesNotExists()
7267
{
68+
$file = $this->File;
69+
7370
$this->assertFalse(
74-
$this->File->exists(__DIR__ . '/test.txt')
71+
$file::exists(__DIR__ . '/test.txt')
7572
);
7673
}
7774

7875
/**
7976
* Test if a external file exists.
80-
*
81-
* @since 1.1.4
8277
*/
8378
public function testIfExternalFileExists()
8479
{
80+
$file = $this->File;
81+
8582
$this->assertTrue(
86-
$this->File->exists('https://raw.githubusercontent.com/Josantonius/PHP-File/master/composer.json')
83+
$file::exists('https://raw.githubusercontent.com/Josantonius/PHP-File/master/composer.json')
8784
);
8885
}
8986

9087
/**
9188
* Test if a external file doesn't exists.
92-
*
93-
* @since 1.1.4
9489
*/
9590
public function testIfExternalFileDoesNotExists()
9691
{
92+
$file = $this->File;
93+
9794
$this->assertFalse(
98-
$this->File->exists('https://raw.githubusercontent.com/unknown.json')
95+
$file::exists('https://raw.githubusercontent.com/unknown.json')
9996
);
10097
}
10198

10299
/**
103100
* Test delete a local file.
104-
*
105-
* @since 1.1.4
106101
*/
107102
public function testDeleteLocalFile()
108103
{
104+
$file = $this->File;
105+
109106
touch(__DIR__ . '/test.txt');
110107

111108
$this->assertTrue(
112-
$this->File->delete(__DIR__ . '/test.txt')
109+
$file::delete(__DIR__ . '/test.txt')
113110
);
114111
}
115112

116113
/**
117114
* Test delete missing local file.
118-
*
119-
* @since 1.1.4
120115
*/
121116
public function testDeleteMissingLocalFile()
122117
{
118+
$file = $this->File;
119+
123120
$this->assertFalse(
124-
$this->File->delete(__DIR__ . '/test.txt')
121+
$file::delete(__DIR__ . '/test.txt')
125122
);
126123
}
127124

128125
/**
129126
* Test create directory.
130-
*
131-
* @since 1.1.4
132127
*/
133128
public function testCreateDir()
134129
{
130+
$file = $this->File;
131+
135132
$this->assertTrue(
136-
$this->File->createDir(__DIR__ . '/test/')
133+
$file::createDir(__DIR__ . '/test/')
137134
);
138135
}
139136

140137
/**
141138
* Test error to create directory.
142-
*
143-
* @since 1.1.4
144139
*/
145140
public function testCreateDirError()
146141
{
142+
$file = $this->File;
143+
147144
$this->assertFalse(
148-
$this->File->createDir('')
145+
$file::createDir('')
149146
);
150147
}
151148

152149
/**
153150
* Test delete empty directory.
154-
*
155-
* @since 1.1.4
156151
*/
157152
public function testDeleteEmptyDir()
158153
{
154+
$file = $this->File;
155+
159156
$this->assertTrue(
160-
$this->File->deleteEmptyDir(__DIR__ . '/test/')
157+
$file::deleteEmptyDir(__DIR__ . '/test/')
161158
);
162159
}
163160

164161
/**
165162
* Test error to delete empty directory.
166-
*
167-
* @since 1.1.4
168163
*/
169164
public function testDeleteEmptyDirError()
170165
{
166+
$file = $this->File;
167+
171168
$this->assertFalse(
172-
$this->File->deleteEmptyDir(__DIR__ . '/test/')
169+
$file::deleteEmptyDir(__DIR__ . '/test/')
173170
);
174171
}
175172

176173
/**
177174
* Test copy directory recursively.
178-
*
179-
* @since 1.1.4
180175
*/
181176
public function testCopyDirRecursively()
182177
{
183-
$this->File->createDir(__DIR__ . '/test/test/test/');
178+
$file = $this->File;
179+
180+
$file::createDir(__DIR__ . '/test/test/test/');
184181

185182
touch(__DIR__ . '/test/test/test/test.txt');
186183

187184
$this->assertTrue(
188-
$this->File->copyDirRecursively(__DIR__ . '/test/', __DIR__ . '/copy/')
185+
$file::copyDirRecursively(__DIR__ . '/test/', __DIR__ . '/copy/')
189186
);
190187
}
191188

192189
/**
193190
* Test copy missing directory recursively.
194-
*
195-
* @since 1.1.4
196191
*/
197192
public function testCopyMissingDirRecursively()
198193
{
194+
$file = $this->File;
195+
199196
$this->assertFalse(
200-
$this->File->deleteDirRecursively(__DIR__ . '/unknown/')
197+
$file::deleteDirRecursively(__DIR__ . '/unknown/')
201198
);
202199
}
203200

204201
/**
205202
* Test delete directory recursively.
206-
*
207-
* @since 1.1.4
208203
*/
209204
public function testDeleteDirRecursively()
210205
{
206+
$file = $this->File;
207+
211208
$this->assertTrue(
212-
$this->File->deleteDirRecursively(__DIR__ . '/test/')
209+
$file::deleteDirRecursively(__DIR__ . '/test/')
213210
);
214211

215212
$this->assertTrue(
216-
$this->File->deleteDirRecursively(__DIR__ . '/copy/')
213+
$file::deleteDirRecursively(__DIR__ . '/copy/')
217214
);
218215
}
219216

220217
/**
221218
* Test delete missing directory recursively.
222-
*
223-
* @since 1.1.4
224219
*/
225220
public function testDeleteMissingDirRecursively()
226221
{
222+
$file = $this->File;
223+
227224
$this->assertFalse(
228-
$this->File->deleteDirRecursively(__DIR__ . '/test/')
225+
$file::deleteDirRecursively(__DIR__ . '/test/')
229226
);
230227
}
231228

232229
/**
233230
* Test get files from directory.
234-
*
235-
* @since 1.1.4
236231
*/
237232
public function testGetFilesFromDir()
238233
{
234+
$file = $this->File;
235+
239236
$this->assertContains(
240237
'DirectoryIterator',
241-
get_class($this->File->getFilesFromDir(__DIR__))
238+
get_class($file::getFilesFromDir(__DIR__))
242239
);
243240
}
244241

245242
/**
246243
* Test get files from missing directory.
247-
*
248-
* @since 1.1.4
249244
*/
250245
public function testGetFilesFromMissingDir()
251246
{
247+
$file = $this->File;
248+
252249
$this->assertFalse(
253-
$this->File->getFilesFromDir('')
250+
$file::getFilesFromDir('')
254251
);
255252
}
256253
}

0 commit comments

Comments
 (0)