Commit e51574ab authored by Sean Madsen's avatar Sean Madsen

Add test for Library::parseIdentifier()

parent ceabe65d
<?php
namespace AppBundle\Model;
class LibraryTest extends \PHPUnit_Framework_TestCase {
/**
* @param string $identifier
* @param array $expected
* @dataProvider identifierProvider
*/
public function testParseIdentifier($identifier, $expected) {
$this->assertEquals($expected, Library::parseIdentifier($identifier));
}
public function identifierProvider() {
return [
[
'',
[
'bookSlug' => NULL,
'languageCode' => NULL,
'versionDescriptor' => NULL,
],
],
[
'/dev',
[
'bookSlug' => 'dev',
'languageCode' => NULL,
'versionDescriptor' => NULL,
],
],
[
'/dev/en',
[
'bookSlug' => 'dev',
'languageCode' => 'en',
'versionDescriptor' => NULL,
],
],
[
'/dev/en/latest',
[
'bookSlug' => 'dev',
'languageCode' => 'en',
'versionDescriptor' => 'latest',
],
],
[
'dev/en/latest',
[
'bookSlug' => 'dev',
'languageCode' => 'en',
'versionDescriptor' => 'latest',
],
],
[
'dev/en/latest/',
[
'bookSlug' => 'dev',
'languageCode' => 'en',
'versionDescriptor' => 'latest',
],
],
[
'//dev///////en//latest///',
[
'bookSlug' => 'dev',
'languageCode' => 'en',
'versionDescriptor' => 'latest',
],
],
];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment