Exemplo n.º 1
0
    public function testOriginalFileChanged()
    {
        $filename = __DIR__.'/files/foo.bar';

        // create tmp file
        touch($filename);

        // get original checksum
        $img = new ImageCache;
        $img->make($filename);
        $img->resize(300, 200);
        $checksum_original = $img->checksum();

        // get modified checksum
        clearstatcache();
        $modified = touch($filename, 10);

        // get modified checksum
        $img = new ImageCache;
        $img->make($filename);
        $img->resize(300, 200);
        $checksum_modified = $img->checksum();

        // delete tmp file
        unlink($filename);

        $this->assertTrue($modified);
        $this->assertNotEquals($checksum_original, $checksum_modified);
    }
Exemplo n.º 2
0
 public function testChecksumWithClosure()
 {
     // closure must be serializable
     $sum = '96cb89799900f6655c75b2b3a671ca38';
     $img = new ImageCache();
     $img->canvas(300, 200, 'fff');
     $img->text('foo', 0, 0, function ($font) {
         $font->valign('top');
         $font->size(32);
     });
     $this->assertEquals($img->checksum(), $sum);
     // checksum must differ, if values in closure change
     $sum = '8ae197da869264c480c3093aa031fb20';
     $img = new ImageCache();
     $img->canvas(300, 200, 'fff');
     $img->text('foo', 0, 0, function ($font) {
         $font->valign('top');
         $font->size(30);
     });
     $this->assertEquals($img->checksum(), $sum);
 }