Skip to content

Commit bfca702

Browse files
committed
Improved phpunit tests
1 parent 83f1ab4 commit bfca702

File tree

14 files changed

+213
-848
lines changed

14 files changed

+213
-848
lines changed

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

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.
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)