|
Revision 36, 0.8 kB
(checked in by fabien, 3 years ago)
|
day 15 modifications
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
require_once('Tag.class.php'); |
|---|
| 4 |
|
|---|
| 5 |
class TagTest extends UnitTestCase |
|---|
| 6 |
{ |
|---|
| 7 |
public function test_normalize() |
|---|
| 8 |
{ |
|---|
| 9 |
$tests = array( |
|---|
| 10 |
'FOO' => 'foo', |
|---|
| 11 |
' foo' => 'foo', |
|---|
| 12 |
'foo ' => 'foo', |
|---|
| 13 |
' foo ' => 'foo', |
|---|
| 14 |
'foo-bar' => 'foobar', |
|---|
| 15 |
|
|---|
| 16 |
' FOo-bar ' => 'foobar', |
|---|
| 17 |
); |
|---|
| 18 |
|
|---|
| 19 |
foreach ($tests as $tag => $normalized_tag) |
|---|
| 20 |
{ |
|---|
| 21 |
$this->assertEqual($normalized_tag, Tag::normalize($tag)); |
|---|
| 22 |
} |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
public function test_splitPhrase() |
|---|
| 26 |
{ |
|---|
| 27 |
$tests = array( |
|---|
| 28 |
'foo' => array('foo'), |
|---|
| 29 |
'foo bar' => array('foo', 'bar'), |
|---|
| 30 |
' foo bar ' => array('foo', 'bar'), |
|---|
| 31 |
'"foo bar" askeet' => array('foo bar', 'askeet'), |
|---|
| 32 |
); |
|---|
| 33 |
|
|---|
| 34 |
foreach ($tests as $tag => $tags) |
|---|
| 35 |
{ |
|---|
| 36 |
$this->assertEqual($tags, Tag::splitPhrase($tag)); |
|---|
| 37 |
} |
|---|
| 38 |
} |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
?> |
|---|
| 42 |
|
|---|