Skip to content

Commit 370af7a

Browse files
committed
Deprecate objectHasAttribute expectations/verifiers
1 parent 688e576 commit 370af7a

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

docs/supported_expectations.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ toHaveSameSizeAs
2121

2222
### BaseObject
2323
```
24-
notToHaveAttribute
25-
toHaveAttribute
2624
notToHaveProperty
2725
toHaveProperty
2826
```

docs/supported_verifiers.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ sameSize
2121

2222
### BaseObject
2323
```
24-
hasAttribute
25-
notHasAttribute
2624
hasProperty
2725
notHasProperty
2826
```

src/Codeception/Verify/Expectations/ExpectBaseObject.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,30 @@ public function __construct(object $object)
2424
/**
2525
* Expect that an object does not have a specified attribute.
2626
*
27+
* @deprecated Deprecated in favour of notToHaveProperty
28+
*
2729
* @param string $attributeName
2830
* @param string $message
2931
* @return self
3032
*/
3133
public function notToHaveAttribute(string $attributeName, string $message = ''): self
3234
{
33-
Assert::assertObjectNotHasAttribute($attributeName, $this->actual, $message);
35+
Assert::assertObjectNotHasProperty($attributeName, $this->actual, $message);
3436
return $this;
3537
}
3638

3739
/**
3840
* Expect that an object has a specified attribute.
3941
*
42+
* @deprecated Deprecated in favour of toHaveProperty
43+
*
4044
* @param string $attributeName
4145
* @param string $message
4246
* @return self
4347
*/
4448
public function toHaveAttribute(string $attributeName, string $message = ''): self
4549
{
46-
Assert::assertObjectHasAttribute($attributeName, $this->actual, $message);
50+
Assert::assertObjectHasProperty($attributeName, $this->actual, $message);
4751
return $this;
4852
}
4953

src/Codeception/Verify/Verifiers/VerifyBaseObject.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,30 @@ public function __construct(object $object)
2424
/**
2525
* Verifies that an object has a specified attribute.
2626
*
27+
* @deprecated Deprecated in favour of hasProperty
28+
*
2729
* @param string $attributeName
2830
* @param string $message
2931
* @return self
3032
*/
3133
public function hasAttribute(string $attributeName, string $message = ''): self
3234
{
33-
Assert::assertObjectHasAttribute($attributeName, $this->actual, $message);
35+
Assert::assertObjectHasProperty($attributeName, $this->actual, $message);
3436
return $this;
3537
}
3638

3739
/**
3840
* Verifies that an object does not have a specified attribute.
3941
*
42+
* @deprecated Deprecated in favour of notHasProperty
43+
*
4044
* @param string $attributeName
4145
* @param string $message
4246
* @return self
4347
*/
4448
public function notHasAttribute(string $attributeName, string $message = ''): self
4549
{
46-
Assert::assertObjectNotHasAttribute($attributeName, $this->actual, $message);
50+
Assert::assertObjectNotHasProperty($attributeName, $this->actual, $message);
4751
return $this;
4852
}
4953

0 commit comments

Comments
 (0)