Skip to content

Commit 3bed92a

Browse files
committed
test: updates tests to use static properties/methods
1 parent 0bfba41 commit 3bed92a

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

tests/_support/Helper/MockModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use StellarWP\Models\Model;
66

77
class MockModel extends Model {
8-
protected $properties = [
8+
protected static $properties = [
99
'id' => 'int',
1010
'firstName' => [ 'string', 'Michael' ],
1111
'lastName' => 'string',

tests/wpunit/ModelTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ public function testSetAttributeShouldAssignPropertyValue() {
110110
* @return void
111111
*/
112112
public function testIsPropertyTypeValidShouldReturnTrueWhenPropertyIsValid() {
113-
$model = new MockModel();
114-
115-
$this->assertTrue( $model->isPropertyTypeValid( 'id', 1 ) );
113+
$this->assertTrue( MockModel::isPropertyTypeValid( 'id', 1 ) );
116114
}
117115

118116
/**
@@ -123,9 +121,7 @@ public function testIsPropertyTypeValidShouldReturnTrueWhenPropertyIsValid() {
123121
* @return void
124122
*/
125123
public function testIsPropertyTypeValidShouldReturnFalseWhenPropertyIsInValid( $key, $value ) {
126-
$model = new MockModel();
127-
128-
$this->assertFalse( $model->isPropertyTypeValid( $key, $value ) );
124+
$this->assertFalse( MockModel::isPropertyTypeValid( $key, $value ) );
129125
}
130126

131127
/**

0 commit comments

Comments
 (0)