| @@ 116-130 (lines=15) @@ | ||
| 113 | * |
|
| 114 | * @return void |
|
| 115 | */ |
|
| 116 | public function fromArrays() |
|
| 117 | { |
|
| 118 | $images = Image::fromArrays( |
|
| 119 | [ |
|
| 120 | ['path' => 'a path', 'extension' => 'an extension'], |
|
| 121 | ['path' => 'another path', 'extension' => 'another extension'], |
|
| 122 | ] |
|
| 123 | ); |
|
| 124 | ||
| 125 | $this->assertSame(2, count($images)); |
|
| 126 | $this->assertSame('an extension', $images[0]->getExtension()); |
|
| 127 | $this->assertSame('a path', $images[0]->getPath()); |
|
| 128 | $this->assertSame('another extension', $images[1]->getExtension()); |
|
| 129 | $this->assertSame('another path', $images[1]->getPath()); |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| 133 | * Verify fromArrays throws when input is invalid. |
|
| @@ 111-125 (lines=15) @@ | ||
| 108 | * |
|
| 109 | * @return void |
|
| 110 | */ |
|
| 111 | public function fromArrays() |
|
| 112 | { |
|
| 113 | $prices = Price::fromArrays( |
|
| 114 | [ |
|
| 115 | ['type' => 'a type', 'price' => 1.0], |
|
| 116 | ['type' => 'another type', 'price' => 2.0], |
|
| 117 | ] |
|
| 118 | ); |
|
| 119 | ||
| 120 | $this->assertSame(2, count($prices)); |
|
| 121 | $this->assertSame('a type', $prices[0]->getType()); |
|
| 122 | $this->assertSame(1.0, $prices[0]->getPrice()); |
|
| 123 | $this->assertSame('another type', $prices[1]->getType()); |
|
| 124 | $this->assertSame(2.0, $prices[1]->getPrice()); |
|
| 125 | } |
|
| 126 | ||
| 127 | /** |
|
| 128 | * Verify fromArrays throws when input is invalid. |
|
| @@ 133-147 (lines=15) @@ | ||
| 130 | * |
|
| 131 | * @return void |
|
| 132 | */ |
|
| 133 | public function fromArrays() |
|
| 134 | { |
|
| 135 | $urls = Url::fromArrays( |
|
| 136 | [ |
|
| 137 | ['type' => 'a type', 'url' => 'a url'], |
|
| 138 | ['type' => 'another type', 'url' => 'another url'], |
|
| 139 | ] |
|
| 140 | ); |
|
| 141 | ||
| 142 | $this->assertSame(2, count($urls)); |
|
| 143 | $this->assertSame('a type', $urls[0]->getType()); |
|
| 144 | $this->assertSame('a url', $urls[0]->getUrl()); |
|
| 145 | $this->assertSame('another type', $urls[1]->getType()); |
|
| 146 | $this->assertSame('another url', $urls[1]->getUrl()); |
|
| 147 | } |
|
| 148 | ||
| 149 | /** |
|
| 150 | * Verify fromArrays throws when input is invalid. |
|