Code Coverage  | 
      ||||||||||
Classes and Traits  | 
       Functions and Methods  | 
       Lines  | 
      ||||||||
| Total |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       2 / 2  | 
       CRAP |         | 
       100.00%  | 
       4 / 4  | 
      
| BooleanExpectation |         | 
       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 BooleanExpectation | |
| * | |
| * @package DataExpectation | |
| * @author Tony Bogdanov <tonybogdanov@gmail.com> | |
| */ | |
| class BooleanExpectation extends AbstractExpectation { | |
| /** | |
| * @return string | |
| */ | |
| public function getType(): string { | |
| return 'boolean'; | |
| } | |
| /** | |
| * @param $data | |
| * @param string|null $path | |
| * | |
| * @return $this | |
| * @throws UnexpectedDataException | |
| */ | |
| public function expect( $data, string $path = null ) { | |
| if ( ! is_bool( $data ) ) { | |
| throw new UnexpectedDataException( $data, $this, $path ); | |
| } | |
| return $this; | |
| } | |
| } |