Skip to content

Commit

Permalink
Typo.
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed May 22, 2016
1 parent 484ebb5 commit 33dfc0f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ $pinyin->convert('带着希望去旅行,比到达终点更美好', PINYIN_ASCI
### 生成用于链接的拼音字符串

```php
$pinyin->permlink('带着希望去旅行'); // dai-zhe-xi-wang-qu-lv-xing
$pinyin->permlink('带着希望去旅行', '.'); // dai.zhe.xi.wang.qu.lv.xing
$pinyin->permalink('带着希望去旅行'); // dai-zhe-xi-wang-qu-lv-xing
$pinyin->permalink('带着希望去旅行', '.'); // dai.zhe.xi.wang.qu.lv.xing
```

### 获取首字符字符串
Expand Down
4 changes: 2 additions & 2 deletions src/Pinyin.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ public function name($stringName, $option = self::NONE)
}

/**
* Return a pinyin permlink from string.
* Return a pinyin permalink from string.
*
* @param string $string
* @param string $delimiter
*
* @return string
*/
public function permlink($string, $delimiter = '-')
public function permalink($string, $delimiter = '-')
{
if (!in_array($delimiter, array('_', '-', '.', ''), true)) {
throw new InvalidArgumentException("Delimiter must be one of: '_', '-', '', '.'.");
Expand Down
14 changes: 7 additions & 7 deletions tests/PinyinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ public function testConvert()
$this->assertSame(array('nín', 'hǎo'), $pinyin->convert('您好!', Pinyin::UNICODE));
}

public function testPermlink()
public function testPermalink()
{
$pinyin = new Pinyin();

$this->assertSame('dai-zhe-xi-wang-qu-lv-xing', $pinyin->permlink('带着希望去旅行'));
$this->assertSame('dai_zhe_xi_wang_qu_lv_xing', $pinyin->permlink('带着希望去旅行', '_'));
$this->assertSame('dai.zhe.xi.wang.qu.lv.xing', $pinyin->permlink('带着希望去旅行', '.'));
$this->assertSame('daizhexiwangqulvxing', $pinyin->permlink('带着希望去旅行', ''));
$this->assertSame('dai-zhe-xi-wang-qu-lv-xing', $pinyin->permalink('带着希望去旅行'));
$this->assertSame('dai_zhe_xi_wang_qu_lv_xing', $pinyin->permalink('带着希望去旅行', '_'));
$this->assertSame('dai.zhe.xi.wang.qu.lv.xing', $pinyin->permalink('带着希望去旅行', '.'));
$this->assertSame('daizhexiwangqulvxing', $pinyin->permalink('带着希望去旅行', ''));

// with number.
$this->assertSame('1-dai-23-zhe-5-6-xi-wang-qu-abc-lv-xing-568', $pinyin->permlink('1带23着。!5_6.=希望去abc旅行568'));
$this->assertSame('1-dai-23-zhe-5-6-xi-wang-qu-abc-lv-xing-568', $pinyin->permalink('1带23着。!5_6.=希望去abc旅行568'));

$this->setExpectedException('InvalidArgumentException', "Delimiter must be one of: '_', '-', '', '.'.");

$this->assertSame('daizhexiwangqulvxing', $pinyin->permlink('带着希望去旅行', '='));
$this->assertSame('daizhexiwangqulvxing', $pinyin->permalink('带着希望去旅行', '='));
}

public function testAbbr()
Expand Down

0 comments on commit 33dfc0f

Please sign in to comment.