<commit_before><?php
/*
 * This file is part of the Sonata package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\Tests\Component\Invoice;

use Sonata\Component\Invoice\InvoiceStatusRenderer;
use Sonata\InvoiceBundle\Entity\BaseInvoice;

/**
 * Class InvoiceStatusRendererTest
 *
 * @package Sonata\Tests\Component\Invoice
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class InvoiceStatusRendererTest extends \PHPUnit_Framework_TestCase
{
    public function testHandles()
    {
        $renderer = new InvoiceStatusRenderer();

        $invoice = new \DateTime;
        $this->assertFalse($renderer->handlesObject($invoice));

        $invoice = $this->getMock('Sonata\Component\Invoice\InvoiceInterface');
        $this->assertTrue($renderer->handlesObject($invoice));
    }

    public function testGetClass()
    {
        $renderer = new InvoiceStatusRenderer();
        $invoice  = $this->getMock('Sonata\Component\Invoice\InvoiceInterface');

        $invoice->expects($this->once())->method('getStatus')->will($this->returnValue(array_rand(BaseInvoice::getStatusList())));
        $this->assertContains($renderer->getStatusClass($invoice, '', 'error'), array('important', 'warning', 'success'));
    }
}<commit_msg>Fixing failing unit test (incorrect status)<commit_after><?php
/*
 * This file is part of the Sonata package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\Tests\Component\Invoice;

use Sonata\Component\Invoice\InvoiceStatusRenderer;
use Sonata\InvoiceBundle\Entity\BaseInvoice;

/**
 * Class InvoiceStatusRendererTest
 *
 * @package Sonata\Tests\Component\Invoice
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class InvoiceStatusRendererTest extends \PHPUnit_Framework_TestCase
{
    public function testHandles()
    {
        $renderer = new InvoiceStatusRenderer();

        $invoice = new \DateTime;
        $this->assertFalse($renderer->handlesObject($invoice));

        $invoice = $this->getMock('Sonata\Component\Invoice\InvoiceInterface');
        $this->assertTrue($renderer->handlesObject($invoice));
    }

    public function testGetClass()
    {
        $renderer = new InvoiceStatusRenderer();
        $invoice  = $this->getMock('Sonata\Component\Invoice\InvoiceInterface');

        $invoice->expects($this->once())->method('getStatus')->will($this->returnValue(array_rand(BaseInvoice::getStatusList())));
        $this->assertContains($renderer->getStatusClass($invoice, '', 'error'), array('danger', 'warning', 'success'));
    }
}
{'fraction_non_alphanumeric': 0.14713306887847097, 'fraction_numerical': 0.0, 'mean_word_length': 4.233962264150944, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 47, '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': '7150968', 'n_tokens_mistral': 810, 'n_tokens_neox': 800, 'n_words': 161}