You are here

public function BiblioContributorUnitTest::testGrabFirstnameInitials in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 tests/contributor.test \BiblioContributorUnitTest::testGrabFirstnameInitials()
  2. 7.2 tests/contributor.test \BiblioContributorUnitTest::testGrabFirstnameInitials()

File

tests/BiblioContributorUnitTest.test, line 44

Class

BiblioContributorUnitTest
Unit tests for contributor functions.

Code

public function testGrabFirstnameInitials() {
  $string = "Ron";
  list($firstname, $initials, $prefix) = _grabFirstnameInitials($string);
  $this
    ->assertIdentical($firstname, 'Ron');
  $this
    ->assertIdentical($initials, '');
  $string = "Ron J.";
  list($firstname, $initials, $prefix) = _grabFirstnameInitials($string);
  $this
    ->assertIdentical($firstname, 'Ron');
  $this
    ->assertIdentical($initials, 'J');
  $string = "sir Ron J.";
  list($firstname, $initials, $prefix) = _grabFirstnameInitials($string);
  $this
    ->assertIdentical($firstname, 'Ron');
  $this
    ->assertIdentical($initials, 'J');
  $this
    ->assertIdentical($prefix, 'sir');
  $string = "R J";
  list($firstname, $initials, $prefix) = _grabFirstnameInitials($string);
  $this
    ->assertIdentical($firstname, '');
  $this
    ->assertIdentical($initials, 'R J');
  $string = "R. J.";
  list($firstname, $initials, $prefix) = _grabFirstnameInitials($string);
  $this
    ->assertIdentical($firstname, '');
  $this
    ->assertIdentical($initials, 'R J');
  $string = "R.J.";
  list($firstname, $initials, $prefix) = _grabFirstnameInitials($string);
  $this
    ->assertIdentical($firstname, '');
  $this
    ->assertIdentical($initials, 'R J');
}