| @@ 256-269 (lines=14) @@ | ||
| 253 | $this->assertEquals($resampled2->TestProperty, $testString); |
|
| 254 | } |
|
| 255 | ||
| 256 | public function testShortcodeHandlerFallsBackToFileProperties() { |
|
| 257 | $image = $this->objFromFixture('Image', 'imageWithTitle'); |
|
| 258 | $parser = new ShortcodeParser(); |
|
| 259 | $parser->register('image', array('Image', 'handle_shortcode')); |
|
| 260 | ||
| 261 | $this->assertEquals( |
|
| 262 | sprintf( |
|
| 263 | '<img src="%s" alt="%s">', |
|
| 264 | $image->Link(), |
|
| 265 | $image->Title |
|
| 266 | ), |
|
| 267 | $parser->parse(sprintf('[image id=%d]', $image->ID)) |
|
| 268 | ); |
|
| 269 | } |
|
| 270 | ||
| 271 | public function testShortcodeHandlerUsesShortcodeProperties() { |
|
| 272 | $image = $this->objFromFixture('Image', 'imageWithTitle'); |
|
| @@ 271-286 (lines=16) @@ | ||
| 268 | ); |
|
| 269 | } |
|
| 270 | ||
| 271 | public function testShortcodeHandlerUsesShortcodeProperties() { |
|
| 272 | $image = $this->objFromFixture('Image', 'imageWithTitle'); |
|
| 273 | $parser = new ShortcodeParser(); |
|
| 274 | $parser->register('image', array('Image', 'handle_shortcode')); |
|
| 275 | ||
| 276 | $this->assertEquals( |
|
| 277 | sprintf( |
|
| 278 | '<img src="%s" alt="Alt content" title="Title content">', |
|
| 279 | $image->Link() |
|
| 280 | ), |
|
| 281 | $parser->parse(sprintf( |
|
| 282 | '[image id="%d" alt="Alt content" title="Title content"]', |
|
| 283 | $image->ID |
|
| 284 | )) |
|
| 285 | ); |
|
| 286 | } |
|
| 287 | ||
| 288 | public function testShortcodeHandlerAddsDefaultAttributes() { |
|
| 289 | $image = $this->objFromFixture('Image', 'imageWithoutTitle'); |
|
| @@ 288-304 (lines=17) @@ | ||
| 285 | ); |
|
| 286 | } |
|
| 287 | ||
| 288 | public function testShortcodeHandlerAddsDefaultAttributes() { |
|
| 289 | $image = $this->objFromFixture('Image', 'imageWithoutTitle'); |
|
| 290 | $parser = new ShortcodeParser(); |
|
| 291 | $parser->register('image', array('Image', 'handle_shortcode')); |
|
| 292 | ||
| 293 | $this->assertEquals( |
|
| 294 | sprintf( |
|
| 295 | '<img src="%s" alt="%s">', |
|
| 296 | $image->Link(), |
|
| 297 | $image->Title |
|
| 298 | ), |
|
| 299 | $parser->parse(sprintf( |
|
| 300 | '[image id="%d"]', |
|
| 301 | $image->ID |
|
| 302 | )) |
|
| 303 | ); |
|
| 304 | } |
|
| 305 | } |
|
| 306 | ||