<commit_before><?php

namespace AppBundle\Resources\views\Report;

use AppBundle\Entity\Client;
use AppBundle\Entity\Report\Report as Report;
use AppBundle\Entity\Report\Status;
use AppBundle\Entity\User;
use AppBundle\Form\Report\ReasonForBalanceType;
use Mockery as m;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\Session;

class BalanceTest extends WebTestCase
{
    /**
     * @var \Symfony\Bundle\FrameworkBundle\Client
     */
    protected $client;

    /**
     * @var Report
     */
    protected $report;
    protected $reportClient;
    protected $deputy;
    protected $templating;

    public function setUp()
    {
        $this->frameworkBundleClient = static::createClient(['environment' => 'test', 'debug' => true]);
        $this->frameworkBundleClient->getContainer()->enterScope('request');
        $request = new Request();
        $request->create('/');
        $this->container = $this->frameworkBundleClient->getContainer();
        $this->container->set('request', $request, 'request');
        // set global variable
        $this->container->get('twig')->addGlobal('app', [
            'session' => m::mock(Session::class, [
                'get' => false,
                'getFlashBag' =>  m::mock(FlashBagInterface::class)->shouldIgnoreMissing()
            ]),
            'user' => m::mock(User::class, [
                'getGaTrackingId'=>null,
                'isDeputyPa'=>false,
                'isDeputyOrg'=>false,
                'isNdrEnabled'=>false,
            ])
        ]);
        $this->templating = $this->container->get('templating');
        $this->container->get('request_stack')->push(Request::createFromGlobals());
    }

    /**
     * @param  array  $methods
     * @return Report
     */
    private function getMockedReport(array $methods)
    {
        $client = m::mock(Client::class)
            ->shouldReceive('getFirstname')->andReturn('Peter')
            ->getMock();

        return m::mock(Report::class, $methods + [
            'getId' => 1,
            'getClient' => $client,
            'getTotalsOffset' => null,
            'getMoneyInTotal' => 1,
            'getMoneyOutTotal' => 2,
            'getGiftsTotalValue' => 3,<commit_msg>Added mock method for isDeputyProf() Fixed phpunit tests broken in master<commit_after><?php

namespace AppBundle\Resources\views\Report;

use AppBundle\Entity\Client;
use AppBundle\Entity\Report\Report as Report;
use AppBundle\Entity\Report\Status;
use AppBundle\Entity\User;
use AppBundle\Form\Report\ReasonForBalanceType;
use Mockery as m;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\Session;

class BalanceTest extends WebTestCase
{
    /**
     * @var \Symfony\Bundle\FrameworkBundle\Client
     */
    protected $client;

    /**
     * @var Report
     */
    protected $report;
    protected $reportClient;
    protected $deputy;
    protected $templating;

    public function setUp()
    {
        $this->frameworkBundleClient = static::createClient(['environment' => 'test', 'debug' => true]);
        $this->frameworkBundleClient->getContainer()->enterScope('request');
        $request = new Request();
        $request->create('/');
        $this->container = $this->frameworkBundleClient->getContainer();
        $this->container->set('request', $request, 'request');
        // set global variable
        $this->container->get('twig')->addGlobal('app', [
            'session' => m::mock(Session::class, [
                'get' => false,
                'getFlashBag' =>  m::mock(FlashBagInterface::class)->shouldIgnoreMissing()
            ]),
            'user' => m::mock(User::class, [
                'getGaTrackingId'=>null,
                'isDeputyPa'=>false,
                'isDeputyOrg'=>false,
                'isDeputyProf'=>false,
                'isNdrEnabled'=>false,
            ])
        ]);
        $this->templating = $this->container->get('templating');
        $this->container->get('request_stack')->push(Request::createFromGlobals());
    }

    /**
     * @param  array  $methods
     * @return Report
     */
    private function getMockedReport(array $methods)
    {
        $client = m::mock(Client::class)
            ->shouldReceive('getFirstname')->andReturn('Peter')
            ->getMock();

        return m::mock(Report::class, $methods + [
            'getId' => 1,
            'getClient' => $client,
            'getTotalsOffset' => null,
            'getMoneyInTotal' => 1,
            'getMoneyOutTotal' => 2,
            'getGiftsTotalValue' => 3,
{'fraction_non_alphanumeric': 0.14691185288826705, 'fraction_numerical': 0.0015990405756546072, 'mean_word_length': 2.6686217008797652, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 82, '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': '3134154', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1395, 'n_words': 238}