Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Alchemy\Zippy\Tests\Archive; use Alchemy\Zippy\Tests\TestCase; use Alche..

Decoded Output download

<?php

namespace Alchemy\Zippy\Tests\Archive;

use Alchemy\Zippy\Tests\TestCase;
use Alchemy\Zippy\Archive\Member;
use Alchemy\Zippy\Archive\MemberInterface;

class MemberTest extends TestCase
{
    public function testNewInstance()
    {
        $member = new Member(
            $this->getResource('archive/located/here'),
             $this->getMockBuilder('\Alchemy\Zippy\Adapter\AdapterInterface')->getMock(),
            'location',
            1233456,
            new \DateTime("2012-07-08 11:14:15"),
            true
        );

        $this->assertTrue($member instanceof MemberInterface);

        return $member;
    }

    /**
     * @depends testNewInstance
     */
    public function testGetLocation($member)
    {
        $this->assertEquals('location', $member->getLocation());
    }

    /**
     * @depends testNewInstance
     */
    public function testIsDir($member)
    {
        $this->assertTrue($member->isDir());
    }

    /**
     * @depends testNewInstance
     */
    public function testGetLastModifiedDate($member)
    {
        $this->assertEquals(new \DateTime("2012-07-08 11:14:15"), $member->getLastModifiedDate());
    }

    /**
     * @depends testNewInstance
     */
    public function testGetSize($member)
    {
        $this->assertEquals(1233456, $member->getSize());
    }

    /**
     * @depends testNewInstance
     */
    public function testToString($member)
    {
        $this->assertEquals('location', (string) $member);
    }

    public function testExtract()
    {
        $mockAdapter =  $this->getMockBuilder('\Alchemy\Zippy\Adapter\AdapterInterface')->getMock();

        $mockAdapter
            ->expects($this->any())
            ->method('extractMembers');

        $member = new Member(
           $this->getResource('archive/located/here'),
           $mockAdapter,
           '/member/located/here',
           1233456,
           new \DateTime("2012-07-08 11:14:15"),
           true
        );

        $file = $member->extract();
        $this->assertEquals(sprintf('%s%s', getcwd(), '/member/located/here'), $file->getPathname());

        $file = $member->extract('/custom/location');
        $this->assertEquals('/custom/location/member/located/here', $file->getPathname());
    }

    public function testRelativeExtract()
    {
        $mockAdapter =  $this->getMockBuilder('\Alchemy\Zippy\Adapter\AdapterInterface')->getMock();

        $mockAdapter
            ->expects($this->any())
            ->method('extractMembers');

        $member = new Member(
           $this->getResource('archive/located/here'),
           $mockAdapter,
           'relative',
           1233456,
           new \DateTime("2012-07-08 11:14:15"),
           true
        );

        $file = $member->extract();
        $this->assertEquals(sprintf('%s%s', getcwd(), '/relative'), $file->getPathname());

        $file = $member->extract('/custom/location');
        $this->assertEquals('/custom/location/relative', $file->getPathname());
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Alchemy\Zippy\Tests\Archive;

use Alchemy\Zippy\Tests\TestCase;
use Alchemy\Zippy\Archive\Member;
use Alchemy\Zippy\Archive\MemberInterface;

class MemberTest extends TestCase
{
    public function testNewInstance()
    {
        $member = new Member(
            $this->getResource('archive/located/here'),
             $this->getMockBuilder('\Alchemy\Zippy\Adapter\AdapterInterface')->getMock(),
            'location',
            1233456,
            new \DateTime("2012-07-08 11:14:15"),
            true
        );

        $this->assertTrue($member instanceof MemberInterface);

        return $member;
    }

    /**
     * @depends testNewInstance
     */
    public function testGetLocation($member)
    {
        $this->assertEquals('location', $member->getLocation());
    }

    /**
     * @depends testNewInstance
     */
    public function testIsDir($member)
    {
        $this->assertTrue($member->isDir());
    }

    /**
     * @depends testNewInstance
     */
    public function testGetLastModifiedDate($member)
    {
        $this->assertEquals(new \DateTime("2012-07-08 11:14:15"), $member->getLastModifiedDate());
    }

    /**
     * @depends testNewInstance
     */
    public function testGetSize($member)
    {
        $this->assertEquals(1233456, $member->getSize());
    }

    /**
     * @depends testNewInstance
     */
    public function testToString($member)
    {
        $this->assertEquals('location', (string) $member);
    }

    public function testExtract()
    {
        $mockAdapter =  $this->getMockBuilder('\Alchemy\Zippy\Adapter\AdapterInterface')->getMock();

        $mockAdapter
            ->expects($this->any())
            ->method('extractMembers');

        $member = new Member(
           $this->getResource('archive/located/here'),
           $mockAdapter,
           '/member/located/here',
           1233456,
           new \DateTime("2012-07-08 11:14:15"),
           true
        );

        $file = $member->extract();
        $this->assertEquals(sprintf('%s%s', getcwd(), '/member/located/here'), $file->getPathname());

        $file = $member->extract('/custom/location');
        $this->assertEquals('/custom/location/member/located/here', $file->getPathname());
    }

    public function testRelativeExtract()
    {
        $mockAdapter =  $this->getMockBuilder('\Alchemy\Zippy\Adapter\AdapterInterface')->getMock();

        $mockAdapter
            ->expects($this->any())
            ->method('extractMembers');

        $member = new Member(
           $this->getResource('archive/located/here'),
           $mockAdapter,
           'relative',
           1233456,
           new \DateTime("2012-07-08 11:14:15"),
           true
        );

        $file = $member->extract();
        $this->assertEquals(sprintf('%s%s', getcwd(), '/relative'), $file->getPathname());

        $file = $member->extract('/custom/location');
        $this->assertEquals('/custom/location/relative', $file->getPathname());
    }
}

Function Calls

None

Variables

None

Stats

MD5 724fce0fb4254cbcd551b29b73b93c99
Eval Count 0
Decode Time 111 ms