assertJsonStringEqualsJsonFile() public static method

Asserts that the generated JSON encoded object and the content of the given file are equal.
public static assertJsonStringEqualsJsonFile ( string $expectedFile, string $actualJson, string $message = '' )
$expectedFile string
$actualJson string
$message string
Example #1
0
 public function isEqualToJsonFile($file)
 {
     Assert::assertJsonStringEqualsJsonFile($file, $this->actual, $this->description);
     return $this;
 }
Example #2
0
 public function equalsJsonFile($file)
 {
     if (!$this->isFileExpectation) {
         a::assertJsonStringEqualsJsonFile($file, $this->actual, $this->description);
     } else {
         a::assertJsonFileEqualsJsonFile($file, $this->actual, $this->description);
     }
 }
Example #3
0
/**
 * Asserts that the generated JSON encoded object and the content of the given file are equal.
 *
 * @param string $expectedFile
 * @param string $actualJson
 * @param string $message
 * @since Method available since Release 3.7.0
 */
function assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = '')
{
    return PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = '');
}
Example #4
0
 /**
  * Expect that the generated JSON encoded object and the content of the given file or JSON string are equal.
  *
  * @param string $expectedFile
  * @param string $message
  *
  * @return Expect
  */
 public function toEqualJsonFile($expectedFile, $message = '')
 {
     if (file_exists($this->value)) {
         // file
         Assert::assertJsonFileEqualsJsonFile($expectedFile, $this->value, $message);
     } else {
         // string
         Assert::assertJsonStringEqualsJsonFile($expectedFile, $this->value, $message);
     }
     return $this;
 }
Example #5
0
 /**
  * Asserts that the generated JSON encoded object and the content of the given vfs file are equal.
  *
  * @param $expectedFile
  * @param $actualJson
  * @param string $message
  */
 public function assertJsonStringEqualsVfsJsonFile($expectedFile, $actualJson, $message = '')
 {
     PHPUnit::assertJsonStringEqualsJsonFile($this->getPath($expectedFile), $actualJson, $message);
 }