Skip to content

Commit c0606e6

Browse files
author
Norbert Orzechowicz
committed
Merge pull request #50 from norzechowicz/phpunit
Moved integration tests from phpspec into phpunit
2 parents 0a04e02 + 56d30c0 commit c0606e6

File tree

14 files changed

+593
-569
lines changed

14 files changed

+593
-569
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ install:
2222

2323
script:
2424
- ./bin/phpspec run --format=pretty
25+
- ./bin/phpunit

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ Currently we support following languages:
194194
* [Português - Brasil](src/Coduo/PHPHumanizer/Resources/translations/difference.pt_BR.yml)
195195
* [Italian](src/Coduo/PHPHumanizer/Resources/translations/difference.it.yml)
196196
* [Dutch](src/Coduo/PHPHumanizer/Resources/translations/difference.nl.yml)
197+
* [Norwegian](src/Coduo/PHPHumanizer/Resources/translations/difference.no.yml)
198+
* [Afrikaans] (src/Coduo/PHPHumanizer/Resources/translations/difference.af.yml)
199+
* [Bulgarian] (src/Coduo/PHPHumanizer/Resources/translations/difference.bg.yml)
197200

198201
# Credits
199202

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@
2121
"symfony/yaml": "~2.3"
2222
},
2323
"require-dev": {
24-
"phpspec/phpspec": "2.0.*"
24+
"phpspec/phpspec": "2.0.*",
25+
"phpunit/phpunit": "^4.5|^5.0"
2526
},
2627
"config": {
2728
"bin-dir": "bin"
2829
},
2930
"autoload": {
30-
"psr-4": {"": "src"}
31+
"psr-4": {
32+
"": "src",
33+
"Coduo\\PHPHumanizer\\Tests\\": "tests/"
34+
}
3135
},
3236
"extra": {
3337
"branch-alias": {

phpunit.xml.dist

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
colors="true"
5+
convertErrorsToExceptions="true"
6+
convertNoticesToExceptions="true"
7+
convertWarningsToExceptions="true"
8+
processIsolation="false"
9+
stopOnFailure="false"
10+
syntaxCheck="false"
11+
bootstrap="tests/bootstrap.php"
12+
>
13+
<testsuites>
14+
<testsuite name="PHP Humanizer Test Suite">
15+
<directory>./tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
<filter>
19+
<whitelist>
20+
<directory>./src/Coduo/PHPHumanizer/</directory>
21+
</whitelist>
22+
</filter>
23+
</phpunit>

spec/Coduo/PHPHumanizer/CollectionSpec.php

Lines changed: 0 additions & 53 deletions
This file was deleted.

spec/Coduo/PHPHumanizer/DateTimeSpec.php

Lines changed: 0 additions & 347 deletions
This file was deleted.

spec/Coduo/PHPHumanizer/NumberSpec.php

Lines changed: 0 additions & 112 deletions
This file was deleted.

spec/Coduo/PHPHumanizer/StringSpec.php

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/Coduo/PHPHumanizer/Number.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static function toRoman($number)
4040
return $romanNumeral->toRoman($number);
4141
}
4242

43-
public function fromRoman($number)
43+
public static function fromRoman($number)
4444
{
4545
$romanNumeral = new RomanNumeral();
4646

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace Coduo\PHPHumanizer\Tests;
4+
5+
use Coduo\PHPHumanizer\Collection;
6+
7+
final class CollectionTest extends \PHPUnit_Framework_TestCase
8+
{
9+
/**
10+
* @dataProvider oxfordCollectionProvider
11+
*/
12+
function test_oxford_collections_humanizing($collection, $limit, $locale, $expectedResult)
13+
{
14+
$this->assertEquals($expectedResult, Collection::oxford($collection, $limit, $locale));
15+
}
16+
17+
public function oxfordCollectionProvider()
18+
{
19+
return array(
20+
// English
21+
array(array("Michal"), null, 'en', 'Michal'),
22+
array(array("Michal", "Norbert"), null, 'en', 'Michal and Norbert'),
23+
array(array("Michal", "Norbert", "Lukasz"), 2, 'en', 'Michal, Norbert, and 1 other'),
24+
array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'en', 'Michal, Norbert, and 2 others'),
25+
array(array("Michal", "Norbert", "Lukasz", "Pawel"), null, 'en', 'Michal, Norbert, Lukasz, and Pawel'),
26+
27+
// Polish
28+
array(array("Michal"), null, 'pl', 'Michal'),
29+
array(array("Michal", "Norbert"), null, 'pl', 'Michal i Norbert'),
30+
array(array("Michal", "Norbert", "Lukasz"), 2, 'pl', 'Michal, Norbert i 1 inny'),
31+
array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'pl', 'Michal, Norbert i 2 innych'),
32+
33+
// Dutch
34+
array(array("Michal"), null, 'nl', 'Michal'),
35+
array(array("Michal", "Norbert"), null, 'nl', 'Michal en Norbert'),
36+
array(array("Michal", "Norbert", "Lukasz"), 2, 'nl', 'Michal, Norbert, en 1 andere'),
37+
array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'nl', 'Michal, Norbert, en 2 andere'),
38+
array(array("Michal", "Norbert", "Lukasz", "Pawel"), null, 'nl', 'Michal, Norbert, Lukasz, en Pawel'),
39+
);
40+
}
41+
}

0 commit comments

Comments
 (0)