示例#1
0
 function test_find()
 {
     //Arrange
     $type = "Thai";
     $id = null;
     $rating = 4;
     $address = "1139 NW Elm Street";
     $description = "Yum yum for my tum tum";
     $test_Cuisine = new Cuisine($type, $id);
     $test_Cuisine->save();
     $name = "Mai Thai";
     $name2 = "Screen Door";
     $cuisine_id = $test_Cuisine->getId();
     $test_Venue = new Venue($name, $cuisine_id, $id, $rating, $address, $description);
     $test_Venue->save();
     $test_Venue2 = new Venue($name, $cuisine_id, $id, $rating, $address, $description);
     $test_Venue2->save();
     //Act
     $result = Venue::find($test_Venue->getId());
     //Assert
     $this->assertEquals($test_Venue, $result);
 }
示例#2
0
<?php

namespace woo\domain;

class Venue
{
    private $id;
    private $name;
    function __construct($id, $name)
    {
        $this->name = $name;
        $this->id = $id;
    }
    function getName()
    {
        return $this->name;
    }
    function getId()
    {
        return $this->id;
    }
}
$x = new Venue(null, 'bob');
$x = new Venue(55, 'bob');
print $x->getName();
print $x->getId();