-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from owncloud/fix-composer
Fix composer & add unit testing on travis
- Loading branch information
Showing
11 changed files
with
137 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
filter: | ||
excluded_paths: | ||
- 'vendor/*' | ||
|
||
imports: | ||
- php | ||
|
||
tools: | ||
external_code_coverage: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: php | ||
php: | ||
# - 5.3 | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
install: | ||
- composer install --dev --no-interaction | ||
|
||
script: | ||
- mkdir -p build/logs | ||
- cd tests | ||
- phpunit --coverage-clover ../build/logs/clover.xml --configuration phpunit.xml | ||
|
||
after_script: | ||
# Create coverage report | ||
- wget https://scrutinizer-ci.com/ocular.phar | ||
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
{ | ||
"name": "deepdiver1975/tarstreamer", | ||
"type": "library", | ||
"description": "A library for dynamically streaming dynamic tar files without the need to have the complete file stored on the server.", | ||
"keywords": ["tar", "archive", "stream", "php"], | ||
"homepage": "https://github.com/DeepDiver1975/TarStreamer", | ||
"license": "MIT", | ||
"require": { | ||
"php": ">=5.3.8" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"DeepDiver1975\\TarStreamer\\": "src/" | ||
} | ||
} | ||
"name": "owncloud/tarstreamer", | ||
"type": "library", | ||
"description": "A library for dynamically streaming dynamic tar files without the need to have the complete file stored on the server.", | ||
"keywords": [ | ||
"tar", | ||
"archive", | ||
"stream", | ||
"php" | ||
], | ||
"homepage": "https://github.com/owncloud/TarStreamer", | ||
"license": "MIT", | ||
"require": { | ||
"php": ">=5.3.8" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"ownCloud\\TarStreamer\\": "src/" | ||
} | ||
}, | ||
"archive": { | ||
"exclude": [ | ||
"test", | ||
"tests" | ||
] | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^4.8", | ||
"pear/pear-core-minimal": "v1.10.0alpha2", | ||
"pear/archive_tar": "~1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace ownCloud\TarStreamer\Tests; | ||
|
||
use Archive_Tar; | ||
use ownCloud\TarStreamer\TarStreamer; | ||
use PHPUnit_Framework_TestCase; | ||
|
||
class Streamer extends PHPUnit_Framework_TestCase | ||
{ | ||
/** @var string */ | ||
private $archive; | ||
|
||
/** @var TarStreamer */ | ||
private $streamer; | ||
|
||
public function setUp() { | ||
$this->archive = tempnam('/tmp' , 'tar'); | ||
$this->streamer = new TarStreamer( | ||
['outstream' => fopen($this->archive, 'w')] | ||
); | ||
} | ||
|
||
/** | ||
* @dataProvider providesNameAndData | ||
* @param $fileName | ||
* @param $data | ||
*/ | ||
public function testSimpleFile($fileName, $data) { | ||
$dataStream = fopen('data://text/plain,'.$data, 'r'); | ||
$this->streamer->addFileFromStream($dataStream, $fileName, 10); | ||
$this->streamer->finalize(); | ||
|
||
$this->assertTar($fileName, $data); | ||
} | ||
|
||
public function providesNameAndData() { | ||
return [ | ||
['foo.bar', '1234567890'], | ||
// ['foobar1234foobar1234foobar1234foobar1234foobar1234foobar1234foobar1234foobar1234foobar1234foobar1234.txt', 'abcdefgh'] | ||
]; | ||
} | ||
|
||
private function assertTar($file, $data) | ||
{ | ||
$arc = new Archive_Tar($this->archive); | ||
$content = $arc->extractInString($file); | ||
$this->assertEquals($data, $content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
require_once __DIR__.'/../vendor/autoload.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<phpunit bootstrap="bootstrap.php"> | ||
<testsuite name='TarStreamer'> | ||
<directory suffix='.php'>./</directory> | ||
</testsuite> | ||
</phpunit> |