Ouzo\Tests\Assert::thatSession PHP Method

thatSession() public static method

Sample usage: Session::push('key1', 'key2', 'value1'); Assert::thatSession()->hasSize(1)->contains('value1'); Class Assert
public static thatSession ( )
    public static function thatSession()
    {
        return ArrayAssert::that(isset($_SESSION) ? $_SESSION : array());
    }

Usage Example

Example #1
0
 /**
  * @test
  */
 public function shouldPushNestedSessionValueWhenArrayIsNotEmpty()
 {
     // given
     Session::push('key1', 'key2', 'value1');
     Session::push('key1', 'key2', 'value2');
     //when
     Session::push('key1', 'key2', 'value3');
     //then
     Assert::thatSession()->hasSize(1);
     $value = Session::get('key1', 'key2');
     Assert::thatArray($value)->containsExactly('value1', 'value2', 'value3');
 }