コード例 #1
0
 public function test_getBySaleItemId()
 {
     /** === Test Data === */
     $ID = 32;
     /** === Mock object itself === */
     $this->obj = \Mockery::mock(Sale::class . '[get]', $this->objArgs);
     /** === Setup Mocks === */
     // $rows = $this->get($where);
     $mRow = 'init data';
     $mRows = [$mRow];
     $this->obj->shouldReceive('get')->once()->with('=' . $ID)->andReturn($mRows);
     // $item = $this->_manObj->create(\Praxigento\Warehouse\Data\Entity\Quantity\Sale::class, ['arg1' => $row]);
     $mItem = 'item';
     $this->mManObj->shouldReceive('create')->once()->with(\Praxigento\Warehouse\Data\Entity\Quantity\Sale::class, ['arg1' => $mRow])->andReturn($mItem);
     /** === Call and asserts  === */
     $res = $this->obj->getBySaleItemId($ID);
     $this->assertTrue(is_array($res));
     $this->assertEquals($mItem, current($res));
 }