Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
recca0120 committed Nov 10, 2024
1 parent 735f432 commit 0145667
Show file tree
Hide file tree
Showing 12 changed files with 754 additions and 408 deletions.
10 changes: 5 additions & 5 deletions tests/AddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AddressTest extends TestCase
{
use MockeryPHPUnitIntegration;

public function testGetTokens()
public function testGetTokens(): void
{
$address = new Address('臺北市大安區市府路1號');

Expand All @@ -22,7 +22,7 @@ public function testGetTokens()
], (array) $address->tokens());
}

public function testGetTokensWithZipcode()
public function testGetTokensWithZipcode(): void
{
$address = new Address('11008臺北市大安區市府路1號');

Expand All @@ -34,7 +34,7 @@ public function testGetTokensWithZipcode()
], (array) $address->tokens());
}

public function testGetTokensWithSubno()
public function testGetTokensWithSubNo(): void
{
$address = new Address('臺北市大安區市府路1之1號');

Expand All @@ -46,7 +46,7 @@ public function testGetTokensWithSubno()
], (array) $address->tokens());
}

public function testGetTokensWithTricky()
public function testGetTokensWithTricky(): void
{
$address = new Address('桃園縣中壢市普義10號');

Expand All @@ -58,7 +58,7 @@ public function testGetTokensWithTricky()
], (array) $address->tokens());
}

public function testGetTokensWithAddress()
public function testGetTokensWithAddress(): void
{
// 20742,新北市,萬里區,二坪,全
// 21042,連江縣,北竿鄉,坂里村,全
Expand Down
2 changes: 2 additions & 0 deletions tests/Moskytw/DirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class DirectoryTest extends TestCase
{
use MockeryPHPUnitIntegration;

private $directory;

protected function setUp(): void
{
$root = vfsStream::setup();
Expand Down
3 changes: 3 additions & 0 deletions tests/Moskytw/stubs/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

class Directory
{
private $storage;
private $rules;

public function __construct($root)
{
$this->storage = new File($root);
Expand Down
2 changes: 2 additions & 0 deletions tests/Moskytw/stubs/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

class Rule
{
private $rule;

public function __construct($rule)
{
$this->rule = new BaseRule($rule);
Expand Down
1,014 changes: 676 additions & 338 deletions tests/NormalizerKaohsiungTest.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/NormalizerTaichungTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class NormalizerTaichungTest extends TestCase
{
public function testNormalizeTaichungAddress()
public function testNormalizeTaichungAddress(): void
{
$this->assertSame('臺中市中區繼光里', (string) Normalizer::factory('臺中市中區繼光里')->normalizeAddress());
$this->assertSame('臺中市中區大墩里', (string) Normalizer::factory('臺中市中區大墩里')->normalizeAddress());
Expand Down
8 changes: 5 additions & 3 deletions tests/NormalizerTainanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

class NormalizerTainanTest extends TestCase
{
public function testNormalizeTainanAddress()
public function testNormalizeTainanAddress(): void
{
$this->assertSame('臺南市新化區[上廿下那]拔里', (string) Normalizer::factory('臺南縣新化鎮[上廿下那]拔里')
->normalizeAddress());
$this->assertSame(
'臺南市新化區[上廿下那]拔里',
(string) Normalizer::factory('臺南縣新化鎮[上廿下那]拔里')->normalizeAddress()
);
// return;
$this->assertSame('臺南市新營區忠政里', (string) Normalizer::factory('臺南縣新營市忠政里')->normalizeAddress());
$this->assertSame('臺南市新營區民權里', (string) Normalizer::factory('臺南縣新營市民權里')->normalizeAddress());
Expand Down
2 changes: 1 addition & 1 deletion tests/NormalizerTaipeiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class NormalizerTaipeiTest extends TestCase
{
public function testNormalizeTaipeiAddress()
public function testNormalizeTaipeiAddress(): void
{
$this->assertSame('新北市板橋區留侯里', (string) Normalizer::factory('臺北縣板橋市留侯里')->normalizeAddress());
$this->assertSame('新北市板橋區流芳里', (string) Normalizer::factory('臺北縣板橋市流芳里')->normalizeAddress());
Expand Down
8 changes: 4 additions & 4 deletions tests/NormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@ public function testDigitize14()
}
}

public function testDigitize94()
public function testDigitize94(): void
{
foreach ($this->units as $unit) {
$normalizer = new Normalizer('臺北市大安區市府九十四'.$unit);
$this->assertSame('臺北市大安區市府94'.$unit, (string) $normalizer->digitize());
}
}

public function testDigitize947()
public function testDigitize947(): void
{
foreach ($this->units as $unit) {
$normalizer = new Normalizer('臺北市大安區市府九百四十七'.$unit);
$this->assertSame('臺北市大安區市府947'.$unit, (string) $normalizer->digitize());
}
}

public function testDigitize9478()
public function testDigitize9478(): void
{
foreach ($this->units as $unit) {
$normalizer = new Normalizer('臺北市大安區市府九千四百七十八'.$unit);
$this->assertSame('臺北市大安區市府9478'.$unit, (string) $normalizer->digitize());
}
}

public function testNormalizeAddress()
public function testNormalizeAddress(): void
{
$this->assertSame('新北市板橋區', (string) Normalizer::factory('臺北縣板橋市')->normalizeAddress());
$this->assertSame('臺中市豐原區', (string) Normalizer::factory('臺中縣豐原市')->normalizeAddress());
Expand Down
Loading

0 comments on commit 0145667

Please sign in to comment.