-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: missing Model::__unset($property)
- Loading branch information
1 parent
e7fe09e
commit 76f0419
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
class MagicMethodsTest extends PHPUnit_Framework_TestCase { | ||
|
||
public function setUp() { | ||
// Set up the dummy database connection | ||
ORM::set_db(new MockPDO('sqlite::memory:')); | ||
|
||
// Enable logging | ||
ORM::configure('logging', true); | ||
|
||
Model::$auto_prefix_models = null; | ||
} | ||
|
||
public function tearDown() { | ||
ORM::configure('logging', false); | ||
ORM::set_db(null); | ||
|
||
Model::$auto_prefix_models = null; | ||
} | ||
|
||
public function testMagicMethodUnset() { | ||
$model = Model::factory("Simple")->create(); | ||
$model->property = "test"; | ||
unset($model->property); | ||
$this->assertFalse(isset($model->property)); | ||
$this->assertTrue($model->get("property")!="test"); | ||
} | ||
} |