-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCarrierEnumTest.php
More file actions
executable file
·33 lines (28 loc) · 1.04 KB
/
Copy pathCarrierEnumTest.php
File metadata and controls
executable file
·33 lines (28 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require __DIR__ . '/CarrierEnum.php';
class CarrierEnumTest extends PHPUnit_Framework_TestCase {
/** @test */
public function valueOfのテスト() {
//DBやcache、ファイルからとってきた値を valueOf するイメージ
$this->assertSame(CarrierEnum::$au,
CarrierEnum::valueOf('au'));
}
/** @test */
public function getNameのテスト() {
//DBやcache、ファイルに書き込むときは getName
$this->assertSame('softbank',
CarrierEnum::$softbank->getName());
}
/** @test */
public function toStringも定義してあるから文字連結したりすると自動で() {
$this->assertSame('hogedocomo',
'hoge'.CarrierEnum::$docomo);
}
/** @test */
public function values() {
//enum だから列挙できるよ!
$values = CarrierEnum::values();
$this->assertSame(4, count($values));
$this->assertSame(CarrierEnum::$docomo, $values[0]);
}
}