Skip to content

Commit

Permalink
Merge pull request #50 from cordoval/improvements
Browse files Browse the repository at this point in the history
various improvements
  • Loading branch information
reoring committed Jan 14, 2015
2 parents 49b21ba + d9f8b33 commit 66c376b
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 26 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.DS_Store
/.idea
.phpmake
/vendor
/composer.phar
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Goodby CSV is fully unit-tested. The library is stable and ready to be used in l

Install composer in your project:

```
```bash
curl -s http://getcomposer.org/installer | php
```

Expand All @@ -60,7 +60,7 @@ Create a `composer.json` file in your project root:

Install via composer:

```
```bash
php composer.phar install
```

Expand Down Expand Up @@ -130,7 +130,7 @@ $lexer->parse('rough.csv', $interpreter);

user.csv:

```
```csv
1,alice,[email protected]
2,bob,[email protected]
3,carol,[email protected]
Expand All @@ -155,14 +155,13 @@ $interpreter->addObserver(function(array $columns) use ($pdo) {
});

$lexer->parse('user.csv', $interpreter);

```

### Import from TSV(tab separated values) to array

temperature.tsv:

```
```csv
9 Tokyo
27 Singapore
-5 Seoul
Expand Down Expand Up @@ -303,7 +302,7 @@ We works under test driven development.

Checkout master source code from github:

```
```bash
hub clone goodby/csv
```

Expand All @@ -319,10 +318,10 @@ composer.phar install --dev

Run phpunit:

```
```bash
./vendor/bin/phpunit
```

## Acknowledgement

editing...
Credits are found within composer.json file.
Empty file.
2 changes: 0 additions & 2 deletions src/Goodby/CSV/Export/Standard/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

use Goodby\CSV\Export\Protocol\ExporterInterface;
use Goodby\CSV\Export\Protocol\Exception\IOException;
use Goodby\CSV\Export\Standard\ExporterConfig;
use Goodby\CSV\Export\Standard\Exception\StrictViolationException;
use SplFileObject;

/**
* Standard exporter class
Expand Down
3 changes: 2 additions & 1 deletion src/Goodby/CSV/Export/Standard/ExporterConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,13 @@ public function getFileMode()

/**
* Set the column headers.
* @param array $headers
* @param array $columnHeaders
* @return ExporterConfig
*/
public function setColumnHeaders(array $columnHeaders)
{
$this->columnHeaders = $columnHeaders;

return $this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Goodby\CSV\Import\Protocol\Exception;

/**
* throw if csv file not found
* Throws if csv file not found
*/
class CsvFileNotFoundException extends \RuntimeException
{
Expand Down
1 change: 0 additions & 1 deletion src/Goodby/CSV/Import/Standard/Interpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/**
* standard interpreter
*
*/
class Interpreter implements InterpreterInterface
{
Expand Down
11 changes: 6 additions & 5 deletions src/Goodby/CSV/Import/Tests/Protocol/InterpreterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

/**
* unit test for Interface of the Interpreter
*
*/
class InterpreterTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -17,8 +16,9 @@ public function testInterpreterInterface()
$interpreter = $this->getMock('\Goodby\CSV\Import\Protocol\InterpreterInterface');

$interpreter->expects($this->once())
->method('interpret')
->with($this->identicalTo($line));
->method('interpret')
->with($this->identicalTo($line))
;

$interpreter->interpret($line);
}
Expand All @@ -31,8 +31,9 @@ public function testInterpreterInterfaceWillThrownInvalidLexicalException()
$interpreter = $this->getMock('\Goodby\CSV\Import\Protocol\InterpreterInterface');

$interpreter->expects($this->once())
->method('interpret')
->will($this->throwException(new InvalidLexicalException()));
->method('interpret')
->will($this->throwException(new InvalidLexicalException()))
;

$line = "INVALID LEXICAL";

Expand Down
5 changes: 3 additions & 2 deletions src/Goodby/CSV/Import/Tests/Protocol/LexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public function testCsvFileNotFound()
$path = 'invalid_dummy.csv';

$lexer->shouldReceive('parse')
->with($path, $interpreter)
->andThrow('Goodby\CSV\Import\Protocol\Exception\CsvFileNotFoundException');
->with($path, $interpreter)
->andThrow('Goodby\CSV\Import\Protocol\Exception\CsvFileNotFoundException')
;

$lexer->parse($path, $interpreter);
}
Expand Down
2 changes: 0 additions & 2 deletions src/Goodby/CSV/Import/Tests/Standard/Join/LexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Goodby\CSV\Import\Standard\Interpreter;
use Goodby\CSV\Import\Standard\LexerConfig;

use Goodby\CSV\Import\Tests\Standard\Join\CSVFiles;

class LexerTest extends \PHPUnit_Framework_TestCase
{
public function test_shift_jis_CSV()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

/**
* unit test for pdo observer
*
*/
class PdoObserverTest extends \PHPUnit_Framework_TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Goodby\CSV\Import\Tests\Standard;

/**
* 結合テストでファイルシステムと結合するときに使うサンドボックスディレクトリを管理する
* Managing sandbox directory to use when joining with the file system for tests
*/
class SandboxDirectoryManager
{
Expand Down

0 comments on commit 66c376b

Please sign in to comment.