PHPUnit_Framework_Assert::assertJsonStringNotEqualsJsonFile PHP Method

assertJsonStringNotEqualsJsonFile() public static method

Asserts that the generated JSON encoded object and the content of the given file are not equal.
public static assertJsonStringNotEqualsJsonFile ( string $expectedFile, string $actualJson, string $message = '' )
$expectedFile string
$actualJson string
$message string
    public static function assertJsonStringNotEqualsJsonFile($expectedFile, $actualJson, $message = '')
    {
        static::assertFileExists($expectedFile, $message);
        $expectedJson = file_get_contents($expectedFile);
        static::assertJson($expectedJson, $message);
        static::assertJson($actualJson, $message);
        // call constraint
        $constraint = new PHPUnit_Framework_Constraint_JsonMatches($expectedJson);
        static::assertThat($actualJson, new PHPUnit_Framework_Constraint_Not($constraint), $message);
    }

Usage Example

Example #1
0
 public function isNotEqualToJsonFile($file)
 {
     Assert::assertJsonStringNotEqualsJsonFile($file, $this->actual, $this->description);
     return $this;
 }
All Usage Examples Of PHPUnit_Framework_Assert::assertJsonStringNotEqualsJsonFile
PHPUnit_Framework_Assert