forked from theiconic/name-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
242 additions
and
22 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
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 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,46 @@ | ||
<?php | ||
|
||
namespace TheIconic\NameParser\Mapper; | ||
|
||
use TheIconic\NameParser\Part\Salutation; | ||
use TheIconic\NameParser\Part\Firstname; | ||
use TheIconic\NameParser\Part\Middlename; | ||
use TheIconic\NameParser\Part\Lastname; | ||
|
||
class MiddlenameMapperTest extends AbstractMapperTest | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function provider() | ||
{ | ||
return [ | ||
[ | ||
'input' => [ | ||
new Firstname('Peter'), | ||
'Fry', | ||
new Lastname('Pan'), | ||
], | ||
'expectation' => [ | ||
new Firstname('Peter'), | ||
new Middlename('Fry'), | ||
new Lastname('Pan'), | ||
], | ||
], | ||
[ | ||
'input' => [ | ||
new Firstname('John'), | ||
'Albert', | ||
'Tiberius', | ||
new Lastname('Brown'), | ||
], | ||
'expectation' => [ | ||
new Firstname('John'), | ||
new Middlename('Albert'), | ||
new Middlename('Tiberius'), | ||
new Lastname('Brown'), | ||
], | ||
], | ||
]; | ||
} | ||
} |
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 TheIconic\NameParser\Mapper; | ||
|
||
use TheIconic\NameParser\Part\Salutation; | ||
use TheIconic\NameParser\Part\Nickname; | ||
|
||
class NicknameMapperTest extends AbstractMapperTest | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function provider() | ||
{ | ||
return [ | ||
[ | ||
'input' => [ | ||
'James', | ||
'(Jim)', | ||
'T.', | ||
'Kirk', | ||
], | ||
'expectation' => [ | ||
'James', | ||
new Nickname('Jim'), | ||
'T.', | ||
'Kirk' | ||
], | ||
], | ||
[ | ||
'input' => [ | ||
new Salutation('Mr'), | ||
'Andre', | ||
'(The', | ||
'Giant)', | ||
'Rene', | ||
'Roussimoff', | ||
], | ||
'expectation' => [ | ||
new Salutation('Mr'), | ||
'Andre', | ||
new Nickname('The'), | ||
new Nickname('Giant'), | ||
'Rene', | ||
'Roussimoff', | ||
], | ||
], | ||
]; | ||
} | ||
} |
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,53 @@ | ||
<?php | ||
|
||
namespace TheIconic\NameParser\Mapper; | ||
|
||
use TheIconic\NameParser\Part\Salutation; | ||
use TheIconic\NameParser\Part\Firstname; | ||
use TheIconic\NameParser\Part\Lastname; | ||
|
||
class SalutationMapperTest extends AbstractMapperTest | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function provider() | ||
{ | ||
return [ | ||
[ | ||
'input' => [ | ||
'Mr.', | ||
'Pan', | ||
], | ||
'expectation' => [ | ||
new Salutation('Mr.'), | ||
'Pan', | ||
], | ||
], | ||
[ | ||
'input' => [ | ||
'Mr', | ||
'Peter', | ||
'Pan', | ||
], | ||
'expectation' => [ | ||
new Salutation('Mr'), | ||
'Peter', | ||
'Pan', | ||
], | ||
], | ||
[ | ||
'input' => [ | ||
'Mr', | ||
new Firstname('James'), | ||
'Miss', | ||
], | ||
'expectation' => [ | ||
new Salutation('Mr'), | ||
new Firstname('James'), | ||
'Miss', | ||
], | ||
], | ||
]; | ||
} | ||
} |
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,69 @@ | ||
<?php | ||
|
||
namespace TheIconic\NameParser\Mapper; | ||
|
||
use TheIconic\NameParser\Part\Lastname; | ||
use TheIconic\NameParser\Part\Firstname; | ||
use TheIconic\NameParser\Part\Suffix; | ||
|
||
class SuffixMapperTest extends AbstractMapperTest | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function provider() | ||
{ | ||
return [ | ||
[ | ||
'input' => [ | ||
'Mr.', | ||
'James', | ||
'Blueberg', | ||
'PhD', | ||
], | ||
'expectation' => [ | ||
'Mr.', | ||
'James', | ||
'Blueberg', | ||
new Suffix('PhD'), | ||
], | ||
], | ||
[ | ||
'input' => [ | ||
'Prince', | ||
'Alfred', | ||
'III', | ||
], | ||
'expectation' => [ | ||
'Prince', | ||
'Alfred', | ||
new Suffix('III'), | ||
], | ||
], | ||
[ | ||
'input' => [ | ||
new Firstname('Paul'), | ||
new Lastname('Smith'), | ||
'Senior', | ||
], | ||
'expectation' => [ | ||
new Firstname('Paul'), | ||
new Lastname('Smith'), | ||
new Suffix('Senior'), | ||
], | ||
], | ||
[ | ||
'input' => [ | ||
'Senior', | ||
new Firstname('James'), | ||
'Norrington', | ||
], | ||
'expectation' => [ | ||
'Senior', | ||
new Firstname('James'), | ||
'Norrington', | ||
], | ||
], | ||
]; | ||
} | ||
} |