<commit_before><?php

namespace OpenOrchestra\MediaAdminBundle\Tests\Twig;

use Phake;
use OpenOrchestra\MediaAdminBundle\Twig\IsFolderDeletableExtension;

/**
 * Class IsFolderDeletableExtension
 */
class IsFolderDeletableExtensionTest extends \PHPUnit_Framework_TestCase
{
    protected $helper;
    protected $folderManager;

    /**
     * Set up the test
     */
    public function setUp()
    {
        $this->folderManager = Phake::mock('OpenOrchestra\MediaAdminBundle\Manager\FolderManager');
        $this->helper = new IsFolderDeletableExtension($this->folderManager);
    }

    /**
     * test instance
     */
    public function testInstance()
    {
        $this->assertInstanceOf('Twig_Extension', $this->helper);
    }

    /**
     */
    public function testIsFolderDeletable()
    {
        $folder = Phake::mock('OpenOrchestra\Media\Model\MediaFolderInterface');

        Phake::when($this->folderManager)->isDeletable(Phake::anyParameters())->thenReturn(true);
        $this->assertEquals($this->helper->isFolderDeletable($folder), true);

        Phake::when($this->folderManager)->isDeletable(Phake::anyParameters())->thenReturn(false);
        $this->assertEquals($this->helper->isFolderDeletable($folder), false);
    }
}
<commit_msg>complete manager test<commit_after><?php

namespace OpenOrchestra\MediaAdminBundle\Tests\Twig;

use Phake;
use OpenOrchestra\MediaAdminBundle\Twig\IsFolderDeletableExtension;

/**
 * Class IsFolderDeletableExtension
 */
class IsFolderDeletableExtensionTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var IsFolderDeletableExtension
     */
    protected $helper;

    protected $folderManager;

    /**
     * Set up the test
     */
    public function setUp()
    {
        $this->folderManager = Phake::mock('OpenOrchestra\MediaAdminBundle\Manager\FolderManager');
        $this->helper = new IsFolderDeletableExtension($this->folderManager);
    }

    /**
     * test instance
     */
    public function testInstance()
    {
        $this->assertInstanceOf('Twig_Extension', $this->helper);
    }

    /**
     * Test is folder deletable
     */
    public function testIsFolderDeletable()
    {
        $folder = Phake::mock('OpenOrchestra\Media\Model\MediaFolderInterface');

        Phake::when($this->folderManager)->isDeletable(Phake::anyParameters())->thenReturn(true);
        $this->assertEquals($this->helper->isFolderDeletable($folder), true);

        Phake::when($this->folderManager)->isDeletable(Phake::anyParameters())->thenReturn(false);
        $this->assertEquals($this->helper->isFolderDeletable($folder), false);
    }

    /**
     * Test get functions
     */
    public function testGetFunctions()
    {
        $functions = $this->helper->getFunctions();

        $this->assertCount(1, $functions);
        $this->assertInstanceOf('Twig_SimpleFunction', $functions[0]);
    }

    /**
     * Test name
     */
    public function testGetName()
    {
        $this->assertSame('is_folder_deletable', $this->helper->getName());
    }
}

{'fraction_non_alphanumeric': 0.13904448105436573, 'fraction_numerical': 0.0006589785831960461, 'mean_word_length': 3.4192139737991267, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5526070', 'n_tokens_mistral': 882, 'n_tokens_neox': 877, 'n_words': 121}