Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
4 / 4 |
| ObjectExpectation | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
4 / 4 |
| getType | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| expect | |
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
|||
| <?php | |
| /** | |
| * Copyright (c) Tony Bogdanov <tonybogdanov@gmail.com> | |
| * | |
| * For the full copyright and license information, please view the LICENSE | |
| * file that was distributed with this source code. | |
| */ | |
| namespace DataExpectation; | |
| use DataExpectation\Exceptions\UnexpectedDataException; | |
| /** | |
| * Class ObjectExpectation | |
| * | |
| * @package DataExpectation | |
| * @author Tony Bogdanov <tonybogdanov@gmail.com> | |
| */ | |
| class ObjectExpectation extends AbstractExpectation { | |
| /** | |
| * @return string | |
| */ | |
| public function getType(): string { | |
| return 'object'; | |
| } | |
| /** | |
| * @param $data | |
| * @param string|null $path | |
| * | |
| * @return $this | |
| * @throws UnexpectedDataException | |
| */ | |
| public function expect( $data, string $path = null ) { | |
| if ( ! is_object( $data ) ) { | |
| throw new UnexpectedDataException( $data, $this, $path ); | |
| } | |
| return $this; | |
| } | |
| } |