| @@ 29-40 (lines=12) @@ | ||
| 26 | }  | 
                                |
| 27 | }  | 
                                |
| 28 | ||
| 29 | public function testCheckCartItemDescription()  | 
                                |
| 30 | 	{ | 
                                |
| 31 | 		Validator::checkCartItemDescription('foo description'); | 
                                |
| 32 | ||
| 33 | 		try { | 
                                |
| 34 | 			Validator::checkCartItemDescription('very long long long cart item description'); | 
                                |
| 35 | $this->fail();  | 
                                |
| 36 | ||
| 37 | 		} catch (\InvalidArgumentException $e) { | 
                                |
| 38 | 			$this->assertSame('Cart item description can have maximum of 40 characters.', $e->getMessage()); | 
                                |
| 39 | }  | 
                                |
| 40 | }  | 
                                |
| 41 | ||
| 42 | public function testCheckCartItemQuantity()  | 
                                |
| 43 | 	{ | 
                                |
| @@ 42-53 (lines=12) @@ | ||
| 39 | }  | 
                                |
| 40 | }  | 
                                |
| 41 | ||
| 42 | public function testCheckCartItemQuantity()  | 
                                |
| 43 | 	{ | 
                                |
| 44 | Validator::checkCartItemQuantity(2);  | 
                                |
| 45 | ||
| 46 | 		try { | 
                                |
| 47 | Validator::checkCartItemQuantity(0);  | 
                                |
| 48 | $this->fail();  | 
                                |
| 49 | ||
| 50 | 		} catch (\InvalidArgumentException $e) { | 
                                |
| 51 | 			$this->assertSame('Quantity must be greater than 0. 0 given.', $e->getMessage()); | 
                                |
| 52 | }  | 
                                |
| 53 | }  | 
                                |
| 54 | ||
| 55 | public function testCheckOrderId()  | 
                                |
| 56 | 	{ | 
                                |
| @@ 115-126 (lines=12) @@ | ||
| 112 | }  | 
                                |
| 113 | }  | 
                                |
| 114 | ||
| 115 | public function testCustomerId()  | 
                                |
| 116 | 	{ | 
                                |
| 117 | 		Validator::checkCustomerId('foo customerId'); | 
                                |
| 118 | ||
| 119 | 		try { | 
                                |
| 120 | 			Validator::checkCustomerId('very very very very very very very very long long long customerId'); | 
                                |
| 121 | $this->fail();  | 
                                |
| 122 | ||
| 123 | 		} catch (\InvalidArgumentException $e) { | 
                                |
| 124 | 			$this->assertSame('CustomerId can have maximum of 50 characters.', $e->getMessage()); | 
                                |
| 125 | }  | 
                                |
| 126 | }  | 
                                |
| 127 | ||
| 128 | public function testPayId()  | 
                                |
| 129 | 	{ | 
                                |
| @@ 128-139 (lines=12) @@ | ||
| 125 | }  | 
                                |
| 126 | }  | 
                                |
| 127 | ||
| 128 | public function testPayId()  | 
                                |
| 129 | 	{ | 
                                |
| 130 | 		Validator::checkPayId('foo payId'); | 
                                |
| 131 | ||
| 132 | 		try { | 
                                |
| 133 | 			Validator::checkPayId('very long long payId'); | 
                                |
| 134 | $this->fail();  | 
                                |
| 135 | ||
| 136 | 		} catch (\InvalidArgumentException $e) { | 
                                |
| 137 | 			$this->assertSame('PayId can have maximum of 15 characters.', $e->getMessage()); | 
                                |
| 138 | }  | 
                                |
| 139 | }  | 
                                |
| 140 | ||
| 141 | }  | 
                                |
| 142 | ||