本文整理汇总了PHP中Car::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Car::getId方法的具体用法?PHP Car::getId怎么用?PHP Car::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Car
的用法示例。
在下文中一共展示了Car::getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shouldBeAbleToPopulateByJSON
/**
* @test
*/
public function shouldBeAbleToPopulateByJSON()
{
// given
$car = new Car(1);
$this->assertEquals(1, $car->getId());
$json = $car;
$array = json_decode($json, true);
// when
$array['brand'] = 'BMW';
$car->setValues($array);
$car->commit();
$newCar = new Car(1);
// then
$this->assertEquals('BMW', $newCar->getBrand());
}
示例2:
}
} else {
$presscontact->setName($_POST["presscontactname"]);
$presscontact->setHTMLContent(utf8_encode($_POST["presscontacthtml"]));
$presscontact->setCarBrandId($_POST["carbrand"]);
$presscontactinsert = $blPressContact->insertPressContact($presscontact);
if (is_numeric($presscontactinsert)) {
$car->setPressContactId($presscontactinsert);
$errorpresscontact["success"] = "Press contact saved!";
} else {
$car->setPressContactId(0);
$errorpresscontact = $presscontactinsert;
}
}
//check if car is set
if ($car->getId() != 0) {
$carprev = $blCar->getCar($_POST["carid"]);
$car->setFolderName($carprev->getFolderName());
$car->setDateAdded($carprev->getDateAdded());
$car->setDateApproved($carprev->getDateApproved());
$car->setUserIdAdded($carprev->getUserIdAdded());
$car->setUserIdApproved($carprev->getUserIdApproved());
$car->setLRClicks($carprev->getLRClicks());
$car->setHRClicks($carprev->getHRClicks());
$car->setViews($carprev->getViews());
$car->setState($carprev->getState());
$car->setDefaultPictureId($carprev->getDefaultPictureId());
$error = $blCar->updateCar($car);
} else {
$car->setState('Design');
$car->setFolderName(uniqid());
示例3: shouldBeAbleToMerge
/**
* @test
*/
public function shouldBeAbleToMerge()
{
// given
$car = new Car();
$car->deleteTableData()->yesImSure();
$car->setBrand("Volkswagen");
$car->setModel("Polo 1.6 TDI");
$car->commit();
$this->addCarProperty($car->getId(), "Hk", "75");
$this->addCarProperty($car->getId(), "Mileage", "42000");
$this->addCarProperty($car->getId(), "Year", "2010");
$cars = new CarsWithProperties();
// when
$values = $cars->getValues();
$firstCar = $values[0];
// then
$this->assertNotNull($firstCar['properties']);
}
示例4: addCarToStatistics
public function addCarToStatistics(Car $car)
{
if (array_key_exists($car->getId(), $this->statisticsCars)) {
$this->statisticsCars[$car->getId()]->increment();
} else {
$this->statisticsCars[$car->getId()] = new StatCountTuple($car);
}
}
示例5: testShouldBeAbleToGetRecordById
/**
* @test
*/
public function testShouldBeAbleToGetRecordById()
{
$car = new Car();
$car->drop()->yesImSure();
$car->createTable();
// when
$car = new Car(1);
// then
$this->assertEquals('Opel', $car->getBrand());
$this->assertEquals('1', $car->getId());
}