mardi 8 novembre 2016

symfony test undefined function

i have problem with my test. I don't know why my function is undefined. I add use statetment, phpstorm see this class. But when run test error with undefined.

namespace tests\AppBundle\Parser;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use AppBundle\Parser\CommissionDataParser;

class CommissionDataParserTest extends WebTestCase {

public function testGroupOrdersByWeek()
{

    $orders = [
        0 => [
            'date'  => '2016-01-10',
            'client_id'        => '2',
            'client_type'=> 'natural',
            'operation_type' => 'cash_in',
            'operation_sum'     => '200.00',
            'operation_currency'      => 'EUR',
        ],

        1 => [
            'date'  => '2016-01-05',
            'client_id'        => '1',
            'client_type'=> 'legal',
            'operation_type' => 'cash_out',
            'operation_sum'     => '300.00',
            'operation_currency'      => 'EUR',
        ],

        2 => [

            'date'  => '2016-01-11',
            'client_id'        => '1',
            'client_type'=> 'natural',
            'operation_type' => 'cash_out',
            'operation_sum'     => '30000',
            'operation_currency'      => 'JPY'
        ]
    ];


    $expected = [
        0 => [
            'date'  => '2016-01-05',
            'client_id'        => '2',
            'client_type'=> 'natural',
            'operation_type' => 'cash_in',
            'operation_sum'     => '200.00',
            'operation_currency'      => 'EUR',
        ],

        1 => [
            'date'  => '2016-01-10',
            'client_id'        => '1',
            'client_type'=> 'legal',
            'operation_type' => 'cash_out',
            'operation_sum'     => '300.00',
            'operation_currency'      => 'EUR',
        ],

        2 => [
            'date'  => '2016-01-11',
            'client_id'        => '1',
            'client_type'=> 'natural',
            'operation_type' => 'cash_out',
            'operation_sum'     => '30000',
            'operation_currency'      => 'JPY'
        ]
    ];

    $um = new CommissionDataParser();
    $result = $um->groupOrdersByWeek($orders);


    $this->assertEquals($expected, $result, '**** -->>>>> result array wrong');

}

Aucun commentaire:

Enregistrer un commentaire