• Hello, does anybody try to create dummy or mock wpdb class with Prophecy in PHPUnit?
    I got my first test something like this:
    $wpdb = $this->prophesize(\wpdb::class);
    $this->sut = new MyClass($wpdb->reveal());
    self::assertInstanceOf(MyClass::class, $this->sut);
    and when running test I get: TypeError: Argument 1 passed to MyClass::__construct() must be an instance of wpdb, instance of Double\stdClass\P1 given.
    Any idea? Maybe some other mock framework will be better? Does anyone have experience with that?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Mocking or create dummy of wpdb class with Prophecy in PHPUnit.’ is closed to new replies.