Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ install:

script:
- ./bin/phpspec run --format=pretty
- ./bin/phpunit
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ Currently we support following languages:
* [Português - Brasil](src/Coduo/PHPHumanizer/Resources/translations/difference.pt_BR.yml)
* [Italian](src/Coduo/PHPHumanizer/Resources/translations/difference.it.yml)
* [Dutch](src/Coduo/PHPHumanizer/Resources/translations/difference.nl.yml)
* [Norwegian](src/Coduo/PHPHumanizer/Resources/translations/difference.no.yml)
* [Afrikaans] (src/Coduo/PHPHumanizer/Resources/translations/difference.af.yml)
* [Bulgarian] (src/Coduo/PHPHumanizer/Resources/translations/difference.bg.yml)

# Credits

Expand Down
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@
"symfony/yaml": "~2.3"
},
"require-dev": {
"phpspec/phpspec": "2.0.*"
"phpspec/phpspec": "2.0.*",
"phpunit/phpunit": "^4.5|^5.0"
},
"config": {
"bin-dir": "bin"
},
"autoload": {
"psr-4": {"": "src"}
"psr-4": {
"": "src",
"Coduo\\PHPHumanizer\\Tests\\": "tests/"
}
},
"extra": {
"branch-alias": {
Expand Down
23 changes: 23 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="PHP Humanizer Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/Coduo/PHPHumanizer/</directory>
</whitelist>
</filter>
</phpunit>
53 changes: 0 additions & 53 deletions spec/Coduo/PHPHumanizer/CollectionSpec.php

This file was deleted.

347 changes: 0 additions & 347 deletions spec/Coduo/PHPHumanizer/DateTimeSpec.php

This file was deleted.

112 changes: 0 additions & 112 deletions spec/Coduo/PHPHumanizer/NumberSpec.php

This file was deleted.

54 changes: 0 additions & 54 deletions spec/Coduo/PHPHumanizer/StringSpec.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Coduo/PHPHumanizer/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function toRoman($number)
return $romanNumeral->toRoman($number);
}

public function fromRoman($number)
public static function fromRoman($number)
{
$romanNumeral = new RomanNumeral();

Expand Down
41 changes: 41 additions & 0 deletions tests/Coduo/PHPHumanizer/Tests/CollectionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Coduo\PHPHumanizer\Tests;

use Coduo\PHPHumanizer\Collection;

final class CollectionTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider oxfordCollectionProvider
*/
function test_oxford_collections_humanizing($collection, $limit, $locale, $expectedResult)
{
$this->assertEquals($expectedResult, Collection::oxford($collection, $limit, $locale));
}

public function oxfordCollectionProvider()
{
return array(
// English
array(array("Michal"), null, 'en', 'Michal'),
array(array("Michal", "Norbert"), null, 'en', 'Michal and Norbert'),
array(array("Michal", "Norbert", "Lukasz"), 2, 'en', 'Michal, Norbert, and 1 other'),
array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'en', 'Michal, Norbert, and 2 others'),
array(array("Michal", "Norbert", "Lukasz", "Pawel"), null, 'en', 'Michal, Norbert, Lukasz, and Pawel'),

// Polish
array(array("Michal"), null, 'pl', 'Michal'),
array(array("Michal", "Norbert"), null, 'pl', 'Michal i Norbert'),
array(array("Michal", "Norbert", "Lukasz"), 2, 'pl', 'Michal, Norbert i 1 inny'),
array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'pl', 'Michal, Norbert i 2 innych'),

// Dutch
array(array("Michal"), null, 'nl', 'Michal'),
array(array("Michal", "Norbert"), null, 'nl', 'Michal en Norbert'),
array(array("Michal", "Norbert", "Lukasz"), 2, 'nl', 'Michal, Norbert, en 1 andere'),
array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'nl', 'Michal, Norbert, en 2 andere'),
array(array("Michal", "Norbert", "Lukasz", "Pawel"), null, 'nl', 'Michal, Norbert, Lukasz, en Pawel'),
);
}
}
Loading