Skip to content

Commit b97dedf

Browse files
Start of v2.x branch.
1 parent 39cdf47 commit b97dedf

File tree

4 files changed

+22
-33
lines changed

4 files changed

+22
-33
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# LocalFile
1+
# LocalFile v2.x
22
[![Latest Stable Version](https://poser.pugx.org/michaeldrennen/local-file/version)](https://packagist.org/packages/michaeldrennen/local-file) [![Total Downloads](https://poser.pugx.org/michaeldrennen/local-file/downloads)](https://packagist.org/packages/michaeldrennen/local-file) [![License](https://poser.pugx.org/michaeldrennen/local-file/license)](https://packagist.org/packages/michaeldrennen/local-file) [![Build Status](https://travis-ci.org/michaeldrennen/LocalFile.svg?branch=v1.0.2)](https://travis-ci.org/michaeldrennen/LocalFile) [![Coverage Status](https://coveralls.io/repos/github/michaeldrennen/LocalFile/badge.svg?branch=master)](https://coveralls.io/github/michaeldrennen/LocalFile?branch=master)
33

44
A small php library that handles some common functions needed for local files.

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
"name": "michaeldrennen/local-file",
33
"description": "A small php library that adds some functions to operate on local files, like an efficient line count function.",
44
"type": "library",
5+
"require": {
6+
"php": "^7.3"
7+
},
58
"require-dev": {
6-
"satooshi/php-coveralls": "^2.0",
7-
"phpunit/phpunit": "^6.5",
8-
"mikey179/vfsStream": "^1.6"
9+
"mikey179/vfsstream": "dev-master",
10+
"phpunit/phpunit": "^8.0",
11+
"php-coveralls/php-coveralls": "^2.1"
12+
913
},
1014
"license": "MIT",
1115
"authors": [
@@ -24,8 +28,5 @@
2428
"psr-4": {
2529
"MichaelDrenen\\LocalFile\\Tests\\": "tests"
2630
}
27-
},
28-
"require": {
29-
"php": "^7.1"
3031
}
3132
}

phpunit.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
convertNoticesToExceptions="true"
88
convertWarningsToExceptions="true"
99
processIsolation="false"
10-
stopOnFailure="false"
11-
syntaxCheck="false"
12-
>
10+
stopOnFailure="false">
1311
<testsuites>
1412
<testsuite name="LocalFile Test Suite">
1513
<directory suffix=".php">./tests/</directory>
@@ -25,8 +23,6 @@
2523
<logging>
2624
<log type="coverage-html"
2725
target="./build/coverage/html"
28-
charset="UTF-8"
29-
highlight="false"
3026
lowUpperBound="35"
3127
highLowerBound="70"/>
3228
<log type="coverage-clover" target="build/logs/clover.xml"/>

tests/SplitTest.php

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
use PHPUnit\Framework\TestCase;
1212
use MichaelDrennen\LocalFile\LocalFile;
1313

14-
class SplitTest extends TestCase
15-
{
14+
class SplitTest extends TestCase {
1615

1716
const VFS_ROOT_DIR = 'vfsRootDir';
1817
const WRITEABLE_DIR_NAME = 'writeableDir';
@@ -57,9 +56,8 @@ class SplitTest extends TestCase
5756
/**
5857
* Set up test environment
5958
*/
60-
public function setUp()
61-
{
62-
self::$vfsRootDirObject = vfsStream::setup(self::VFS_ROOT_DIR);
59+
public function setUp(): void {
60+
self::$vfsRootDirObject = vfsStream::setup(self::VFS_ROOT_DIR);
6361
self::$writeableDirectory = vfsStream::url(self::VFS_ROOT_DIR . DIRECTORY_SEPARATOR . self::WRITEABLE_DIR_NAME);
6462
mkdir(self::$writeableDirectory, 0777);
6563
self::$anotherWriteableDirectory = vfsStream::url(self::VFS_ROOT_DIR . DIRECTORY_SEPARATOR . self::ANOTHER_WRITEABLE_DIR_NAME);
@@ -76,29 +74,25 @@ public function setUp()
7674
}
7775

7876

79-
public function testSplitWithNonExistentFileShouldThrowException()
80-
{
77+
public function testSplitWithNonExistentFileShouldThrowException() {
8178
$this->expectException(SourceFileDoesNotExist::class);
8279
LocalFile::split(self::PATH_TO_NON_EXISTENT_FILE);
8380
}
8481

85-
public function testSplitWithUnreadableFileShouldThrowException()
86-
{
82+
public function testSplitWithUnreadableFileShouldThrowException() {
8783
$this->expectException(UnableToReadFile::class);
8884
LocalFile::split(self::$unreadableSourceFilePath);
8985
}
9086

91-
public function testSplitIntoReadOnlyDirectoryShouldThrowException()
92-
{
87+
public function testSplitIntoReadOnlyDirectoryShouldThrowException() {
9388
$this->expectException(CantWriteToReadOnlyDirectory::class);
9489
LocalFile::split(self::PATH_TO_SOURCE_FILE, 1, 'split_', self::$readOnlyDirectory);
9590
}
9691

9792
/**
9893
* @group quota
9994
*/
100-
public function testSplitIntoFullDiskShouldThrowException()
101-
{
95+
public function testSplitIntoFullDiskShouldThrowException() {
10296
$this->expectException(UnableToWriteLineToSplitFile::class);
10397
// Gives me enough room to write the source file.
10498
$bytesInSourceFile = filesize(self::PATH_TO_SOURCE_FILE);
@@ -114,8 +108,7 @@ public function testSplitIntoFullDiskShouldThrowException()
114108
}
115109

116110

117-
public function testSplitShouldMakeFiveFilesInSameDirectory()
118-
{
111+
public function testSplitShouldMakeFiveFilesInSameDirectory() {
119112
LocalFile::split(self::$readableSourceFilePath, 4);
120113
$files = scandir(self::$writeableDirectory);
121114
$this->assertCount(9, $files); // includes . and ..
@@ -129,13 +122,12 @@ public function testSplitShouldMakeFiveFilesInSameDirectory()
129122
* @throws \MichaelDrennen\LocalFile\Exceptions\UnableToWriteLineToSplitFile
130123
* @group mike
131124
*/
132-
public function testSplitShouldMakeFiveFilesInAnotherDirectory()
133-
{
125+
public function testSplitShouldMakeFiveFilesInAnotherDirectory() {
134126
$expectedFinalFileCount = 5;
135-
$linesPerFile = 4;
136-
$virtualSourceFilePath = vfsStream::url(self::VFS_ROOT_DIR . DIRECTORY_SEPARATOR .
137-
self::WRITEABLE_DIR_NAME . DIRECTORY_SEPARATOR .
138-
self::SOURCE_FILE_NAME);
127+
$linesPerFile = 4;
128+
$virtualSourceFilePath = vfsStream::url(self::VFS_ROOT_DIR . DIRECTORY_SEPARATOR .
129+
self::WRITEABLE_DIR_NAME . DIRECTORY_SEPARATOR .
130+
self::SOURCE_FILE_NAME);
139131
file_put_contents($virtualSourceFilePath, file_get_contents(self::PATH_TO_SOURCE_FILE));
140132

141133
LocalFile::split($virtualSourceFilePath, $linesPerFile, null, self::$anotherWriteableDirectory);

0 commit comments

Comments
 (0)