public function test_getById() { /** === Test Data === */ $id = 1; /** === Call and asserts === */ $res = $this->obj->getById($id); $this->assertNotNull($res); }
public function test_getById() { /** === Test Data === */ $ID = 32; $DATA = [AggLot::AS_ID => $ID]; /** === Setup Mocks === */ // $query = $this->_factorySelect->getQueryToSelect(); $mQuery = $this->_mockDbSelect(); $this->mFactorySelect->shouldReceive('getQueryToSelect')->once()->andReturn($mQuery); // $query->where($where); $mQuery->shouldReceive('where')->once(); // $data = $this->_conn->fetchRow($query, ['id' => $id]); $this->mConn->shouldReceive('fetchRow')->once()->andReturn($DATA); // $result = $this->_manObj->create(AggWarehouse::class); $this->mManObj->shouldReceive('create')->once()->andReturn(new AggLot()); /** === Call and asserts === */ $res = $this->obj->getById($ID); $this->assertEquals($ID, $res->getId()); }