<commit_before><?php

class OrderActionsTest extends DatabaseTestBase {
    protected function setUp() {
        parent::setUp();
        $mailMock = $this->getMockBuilder(MailInterface::class)
            ->setMethods(['sendOrderNotification', 'sendOrderConfirmation'])
            ->getMock();
        $this->container['mail'] = $mailMock;
        $reserverMock = $this->getMockBuilder(SeatReserverInterface::class)
            ->setMethods(['order'])
            ->getMock();
        $this->container['seatReserver'] = $reserverMock;
    }

    public function testUseReserverToCreateOrder() {
        $action = new Actions\CreateOrderAction($this->container);

        $data = [
            "firstname" => "John",
            "lastname" => "Doe",
            "email" => "<EMAIL>"
        ];
        $request = $this->getPostRequest('/events', $data);
        $response = new \Slim\Http\Response();

        $reserverMock = $this->container->get('seatReserver');

        $reserverMock->expects($this->once())->method('order');
        $action($request, $response, []); 
    }

    public function testSendOrderConfirmation() {
        $action = new Actions\CreateOrderAction($this->container);

        $data = [
            "firstname" => "John",
            "lastname" => "Doe",
            "email" => "<EMAIL>"
        ];
        $request = $this->getPostRequest('/events', $data);
        $response = new \Slim\Http\Response();

        $mailMock = $this->container->get('mail');

        $mailMock->expects($this->once())->method('sendOrderConfirmation');
        $action($request, $response, []);
    }

    public function testSendOrderNotification() {
        $action = new Actions\CreateOrderAction($this->container);

        $data = [
            "firstname" => "John",
            "lastname" => "Doe",
            "email" => "<EMAIL>"
        ];
        $request = $this->getPostRequest('/events', $data);
        $response = new \Slim\Http\Response();

        $mailMock = $this->container->get('mail');

        $mailMock->expects($this->once())->method('sendOrderNotification');
        $action($request, $response, []);
    }
}<commit_msg>Fix tests<commit_after><?php

class OrderActionsTest extends DatabaseTestBase {
    protected function setUp() {
        parent::setUp();
        $mailMock = $this->getMockBuilder(MailInterface::class)
            ->setMethods(['sendOrderNotification', 'sendOrderConfirmation'])
            ->getMock();
        $this->container['mail'] = $mailMock;
        $reserverMock = $this->getMockBuilder(SeatReserverInterface::class)
            ->setMethods(['order'])
            ->getMock();
        $reserverMock
            ->method('order')
            ->willReturn(new OrderStub());
        $this->container['seatReserver'] = $reserverMock;
    }

    public function testUseReserverToCreateOrder() {
        $action = new Actions\CreateOrderAction($this->container);

        $data = [
            "firstname" => "John",
            "lastname" => "Doe",
            "email" => "<EMAIL>"
        ];
        $request = $this->getPostRequest('/events', $data);
        $response = new \Slim\Http\Response();

        $reserverMock = $this->container->get('seatReserver');

        $reserverMock->expects($this->once())->method('order');
        $action($request, $response, []);
    }

    public function testSendOrderConfirmation() {
        $action = new Actions\CreateOrderAction($this->container);

        $data = [
            "firstname" => "John",
            "lastname" => "Doe",
            "email" => "<EMAIL>"
        ];
        $request = $this->getPostRequest('/events', $data);
        $response = new \Slim\Http\Response();

        $mailMock = $this->container->get('mail');

        $mailMock->expects($this->once())->method('sendOrderConfirmation');
        $action($request, $response, []);
    }

    public function testSendOrderNotification() {
        $action = new Actions\CreateOrderAction($this->container);

        $data = [
            "firstname" => "John",
            "lastname" => "Doe",
            "email" => "<EMAIL>"
        ];
        $request = $this->getPostRequest('/events', $data);
        $response = new \Slim\Http\Response();

        $mailMock = $this->container->get('mail');

        $mailMock->expects($this->once())->method('sendOrderNotification');
        $action($request, $response, []);
    }
}

class OrderStub {
    public $reservations;

    public function __construct() {
        $this->reservations = [
            new ExpandedReservationMock()
        ];
    }
}

class ExpandedReservationMock {
    public $price;

    public function __construct() {
        $this->price = 1;
    }
}
{'fraction_non_alphanumeric': 0.17212069698257543, 'fraction_numerical': 0.00021249468763280918, 'mean_word_length': 2.4307580174927113, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 89, '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': '6582733', 'n_tokens_mistral': 1356, 'n_tokens_neox': 1303, 'n_words': 212}