@@ -14,7 +14,10 @@ class EdgeAttributesTest extends TestCase
14
14
*/
15
15
private $ edge ;
16
16
17
- public function setUp ()
17
+ /**
18
+ * @before
19
+ */
20
+ public function setUpGraph ()
18
21
{
19
22
20
23
$ graph = new Graph ();
@@ -40,61 +43,49 @@ public function testCanSetFlowBeforeCapacity()
40
43
$ this ->assertEquals (null , $ this ->edge ->getCapacityRemaining ());
41
44
}
42
45
43
- /**
44
- * @expectedException RangeException
45
- */
46
46
public function testFlowMustNotExceedCapacity ()
47
47
{
48
48
$ this ->edge ->setCapacity (20 );
49
+
50
+ $ this ->setExpectedException ('RangeException ' );
49
51
$ this ->edge ->setFlow (100 );
50
52
}
51
53
52
- /**
53
- * @expectedException RangeException
54
- */
55
54
public function testCapacityMustBeGreaterThanFlow ()
56
55
{
57
56
$ this ->edge ->setFlow (100 );
57
+
58
+ $ this ->setExpectedException ('RangeException ' );
58
59
$ this ->edge ->setCapacity (20 );
59
60
}
60
61
61
- /**
62
- * @expectedException InvalidArgumentException
63
- */
64
62
public function testWeightMustBeNumeric ()
65
63
{
64
+ $ this ->setExpectedException ('InvalidArgumentException ' );
66
65
$ this ->edge ->setWeight ("10 " );
67
66
}
68
67
69
- /**
70
- * @expectedException InvalidArgumentException
71
- */
72
68
public function testCapacityMustBeNumeric ()
73
69
{
70
+ $ this ->setExpectedException ('InvalidArgumentException ' );
74
71
$ this ->edge ->setCapacity ("10 " );
75
72
}
76
73
77
- /**
78
- * @expectedException InvalidArgumentException
79
- */
80
74
public function testCapacityMustBePositive ()
81
75
{
76
+ $ this ->setExpectedException ('InvalidArgumentException ' );
82
77
$ this ->edge ->setCapacity (-10 );
83
78
}
84
79
85
- /**
86
- * @expectedException InvalidArgumentException
87
- */
88
80
public function testFlowMustBeNumeric ()
89
81
{
82
+ $ this ->setExpectedException ('InvalidArgumentException ' );
90
83
$ this ->edge ->setFlow ("10 " );
91
84
}
92
85
93
- /**
94
- * @expectedException InvalidArgumentException
95
- */
96
86
public function testFlowMustBePositive ()
97
87
{
88
+ $ this ->setExpectedException ('InvalidArgumentException ' );
98
89
$ this ->edge ->setFlow (-10 );
99
90
}
100
91
}
0 commit comments