Skip to content

Commit

Permalink
Merge pull request #161 from juvenn/fix/test-create-object
Browse files Browse the repository at this point in the history
Test create sub object
  • Loading branch information
juvenn authored Oct 23, 2017
2 parents 1b6501f + 53e433b commit de96d95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 0 additions & 12 deletions .pullapprove.yml

This file was deleted.

14 changes: 14 additions & 0 deletions test/ObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

class Movie extends Object {
protected static $className = "Movie";
public function setTitle($title) {
$this->set("title", $title);
}

public function getTitle() {
return $this->get("title");
}
}
Movie::registerClass();

Expand Down Expand Up @@ -66,6 +73,13 @@ public function testeSetPreservedField() {
}
}

public function testCreateSubObject() {
$movie = Object::create("Movie", "objid");
$this->assertTrue($movie instanceof Movie);
$movie->setTitle("Alice in wonderland");
$this->assertEquals("Alice in wonderland", $movie->getTitle());
}

public function testIncrement() {
$movie = new Movie();
$movie->set("score", 60);
Expand Down

0 comments on commit de96d95

Please sign in to comment.