Ejemplo n.º 1
0
 function testImageSizes()
 {
     $pid = $this->factory->post->create();
     $filename = self::copyTestImage('arch.jpg');
     $attachment = array('post_title' => 'The Arch', 'post_content' => '');
     $iid = wp_insert_attachment($attachment, $filename, $pid);
     $image = new TimberImage($iid);
     $this->assertEquals(1500, $image->width());
     $this->assertEquals(1000, $image->height());
     $this->assertEquals($pid, $image->parent()->id);
     $this->assertEquals(1.5, $image->aspect());
 }
Ejemplo n.º 2
0
 function testFalseParent()
 {
     $pid = $this->factory->post->create();
     $filename = TestTimberImage::copyTestImage('arch.jpg');
     $attachment = array('post_title' => 'The Arch', 'post_content' => '');
     $iid = wp_insert_attachment($attachment, $filename, $pid);
     update_post_meta($iid, 'architect', 'Eero Saarinen');
     $image = new TimberImage($iid);
     $parent = $image->parent();
     $this->assertEquals($pid, $parent->ID);
     $this->assertFalse($parent->parent());
 }
Ejemplo n.º 3
0
 function testImageNoParent()
 {
     $filename = self::copyTestImage('arch.jpg');
     $image = new TimberImage($filename);
     $this->assertFalse($image->parent());
 }