<commit_before><?php

namespace Tests;


use Codeages\Biz\Order\Dao\OrderDao;
use Codeages\Biz\Order\Dao\OrderLogDao;
use Codeages\Biz\Order\Service\OrderService;
use Codeages\Biz\Order\Service\WorkflowService;

class OrderServiceTest extends IntegrationTestCase
{
    public function setUp()
    {
        parent::setUp();
        $currentUser = array(
            'id' => 1
        );
        $this->biz['user'] = $currentUser;
    }

    /**
     * @expectedException Codeages\Biz\Framework\Service\Exception\AccessDeniedException
     */
    public function testCreateOrderWithoutLogin()
    {
        $orderItems = $this->mockOrderItems();
        $order = $this->mockOrder();
        $this->biz['user'] = array();
        $this->getWorkflowService()->start($order, $orderItems);
    }

    /**
     * @expectedException Codeages\Biz\Framework\Service\Exception\InvalidArgumentException
     */
    public function testCreateOrderWithoutTitle()
    {
        $orderItems = $this->mockOrderItems();
        unset($orderItems[0]['title']);
        $this->getWorkflowService()->start($this->mockOrder(), $orderItems);
    }

    /**
     * @expectedException Codeages\Biz\Framework\Service\Exception\InvalidArgumentException<commit_msg>单元测试修改<commit_after><?php

namespace Tests;


use Codeages\Biz\Order\Dao\OrderDao;
use Codeages\Biz\Order\Dao\OrderLogDao;
use Codeages\Biz\Order\Service\OrderService;
use Codeages\Biz\Order\Service\WorkflowService;

class OrderServiceTest extends IntegrationTestCase
{
    public function setUp()
    {
        parent::setUp();
        $currentUser = array(
            'id' => 1
        );
        $this->biz['user'] = $currentUser;
    }

    /**
     * @expectedException Codeages\Biz\Framework\Service\Exception\AccessDeniedException
     */
    public function testCreateOrderWithoutLogin()
    {
        $orderItems = $this->mockOrderItems();
        $order = $this->mockOrder();
        $currentUser = &$this->biz['user'];
        unset($currentUser['id']);
        $this->getWorkflowService()->start($order, $orderItems);
    }

    /**
     * @expectedException Codeages\Biz\Framework\Service\Exception\InvalidArgumentException
     */
    public function testCreateOrderWithoutTitle()
    {
        $orderItems = $this->mockOrderItems();
        unset($orderItems[0]['title']);
        $this->getWorkflowService()->start($this->mockOrder(), $orderItems);
    }

    /**
     * @expectedException Codeages\Biz\Framework\Service\Exception\InvalidArgumentException
{'fraction_non_alphanumeric': 0.1402390438247012, 'fraction_numerical': 0.0015936254980079682, 'mean_word_length': 3.1435643564356437, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '3930666', 'n_tokens_mistral': 733, 'n_tokens_neox': 727, 'n_words': 100}