Eccube\Tests\Repository\ProductRepositoryGetQueryBuilderBySearchDataAdminTest::testStockStatus PHP Method

testStockStatus() public method

public testStockStatus ( )
    public function testStockStatus()
    {
        $faker = $this->getFaker();
        // 全商品の在庫を 1 以上にしておく
        $Products = $this->app['eccube.repository.product']->findAll();
        foreach ($Products as $Product) {
            foreach ($Product->getProductClasses() as $ProductClass) {
                $ProductClass->setStockUnlimited(false)->setStock($faker->numberBetween(1, 999));
            }
        }
        $this->app['orm.em']->flush();
        // 1商品だけ 0 に設定する
        $Product = $this->app['eccube.repository.product']->findOneBy(array('name' => '商品-1'));
        foreach ($Product->getProductClasses() as $ProductClass) {
            $ProductClass->setStockUnlimited(false)->setStock(0);
        }
        $this->app['orm.em']->flush();
        $this->searchData = array('stock_status' => 0);
        $this->scenario();
        $this->expected = 1;
        $this->actual = count($this->Results);
        $this->verify();
    }