示例#1
0
 /**
  * @test
  * @return Container
  */
 public function setWithValue()
 {
     $subject = new Actual();
     $subject->push('sample', new Actual('nest'));
     $this->assertNotNull($subject->sample);
     return $subject;
 }
 /**
  * @test
  * @expectedException \SwaggerAssert\Exception\CompareException
  */
 public function tooManyExpectedKey()
 {
     $expected = new Expected();
     $expected->push('a');
     $expected->push('b');
     $expected->push('c');
     $actual = new Actual();
     $actual->push('a');
     $actual->push('b');
     $picker = $this->createPickerMock($expected, $actual);
     $subject = new CompareResponseAndAnnotation($picker);
     $subject->execute();
 }
示例#3
0
 /**
  * @test
  */
 public function nestCase()
 {
     $expected = new Expected();
     $expected->push('a');
     $expected->push('b', new Expected('c'));
     $expected->push('d', new Expected('e', new Expected('f')));
     $actual = new Actual();
     $actual->push('a');
     $actual->push('b', new Actual('c'));
     $actual->push('d', new Actual('e', new Actual('f')));
     $picker = $this->createPickerMock($expected, $actual);
     $subject = new CompareResponseAndAnnotation($picker);
     $this->assertTrue($subject->execute());
 }
示例#4
0
 /**
  * @param array $response
  * @return Actual
  */
 private function getActualRecursively($response)
 {
     $actual = new Actual();
     $compress = $this->getCompressed($response);
     if ($compress !== false) {
         $collectionActual = new Actual();
         foreach ($compress as $compressedVal) {
             $collectionActual->push($compressedVal);
         }
         $actual->push('collection', $collectionActual);
         return $actual;
     }
     foreach ($response as $key => $val) {
         is_array($val) ? $actual->push($key, $this->getActualRecursively($val)) : $actual->push($key);
     }
     return $actual;
 }