/** @test */ public function simpleStubWithPhake() { $service = \Phake::mock('\\Acme\\ServiceInterface'); \Phake::when($service)->readTemp()->thenReturn(10)->thenReturn(12)->thenReturn(14); $temperature = new Temperature($service); $this->assertEquals(12, $temperature->average()); }
public function testGetsAverageTemperatureFromThreeServiceReadings() { $service = m::mock('service'); $service->shouldReceive('readTemp')->times(3)->andReturn(10, 12, 14); $temperature = new Temperature($service); $this->assertEquals(12, $temperature->average()); }
public function testDynamicUnit() { $Temp = new Temperature(); $Temp->setTemperature(20, Temperature::CELSIUS); $this->assertEquals('20 °C', $Temp->asString()); $Temp->toFahrenheit(); $this->assertEquals('68 °F', $Temp->asString()); $Temp->setTemperature(32); $this->assertEquals('32 °F', $Temp->asString()); $Temp->toCelsius(); $this->assertEquals('0 °C', $Temp->asString()); $this->assertFalse($Temp->isUnknown()); }
<?php function __autoload($class) { require "lib/{$class}.php"; } // Use your login/password and raspberry_pi_ip_address $db = new DB("mysql", "pi_temp", "localhost", "root", "password"); $measure = new Temperature($db); $k = $measure->doMeasure("raspberry_pi_ip_address", "pi", "raspberry"); $measure->insertMeasure($k["date"], $k["temperature"], $k["humidity"]);
?> <?php echo $form->dropDownListGroup($model, 'loading_id', ['widgetOptions' => ['data' => [], 'htmlOptions' => ['class' => 'span5', 'maxlength' => 9, 'empty' => 'Select supplier address']]]); ?> <?php echo $form->dropDownListGroup($model, 'delivery_id', ['widgetOptions' => ['data' => DeliveryAddress::getList(), 'htmlOptions' => ['class' => 'span5', 'maxlength' => 9, 'empty' => 'Select delivery address']]]); ?> <?php echo $form->dropDownListGroup($model, 'currency_id', ['widgetOptions' => ['data' => Currency::getList(), 'htmlOptions' => ['class' => 'span5', 'empty' => 'Select currency']]]); ?> <?php echo $form->dropDownListGroup($model, 'temperature_id', ['widgetOptions' => ['data' => Temperature::getList(), 'htmlOptions' => ['class' => 'span5', 'empty' => 'Select temperature']]]); ?> <?php echo $form->datePickerGroup($model, 'valid_date', ['widgetOptions' => ['options' => ['format' => 'yyyy-mm-dd', 'startDate' => '0d', 'autoclose' => true], 'htmlOptions' => ['class' => 'span5', 'placeholder' => 'Select date']]]); ?> <?php echo $form->datePickerGroup($model, 'load_date', ['widgetOptions' => ['options' => ['format' => 'yyyy-mm-dd', 'startDate' => '0d', 'autoclose' => true], 'htmlOptions' => ['class' => 'span5', 'placeholder' => 'Select date']]]); ?> <?php echo $form->datePickerGroup($model, 'deliver_date', ['widgetOptions' => ['options' => ['format' => 'yyyy-mm-dd', 'startDate' => '0d', 'autoclose' => true], 'htmlOptions' => ['class' => 'span5', 'placeholder' => 'Select date']]]); ?> <h5><strong><?php
/** * @covers Marando\Units\Temperature::K */ public function testK() { $temp = Temperature::K(0); $this->assertEquals(-273.15, $temp->C, 'C', 0.01); $this->assertEquals(-459.67, $temp->F, 'F', 0.01); }
<?php function __autoload($class) { require "lib/{$class}.php"; } $db = new DB("mysql", "pi_temp", "localhost", "root", "password"); $measure = new Temperature($db); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>piTemp</title> <script src="js/chart.min.js"></script> <!-- Bootstrap core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <hr> <div class="container"> <p class="well"> <span id="temperature">