/** * @dataProvider loadFixtureFileErrProvider * * @covers ::loadFixtureData * @covers ::loadSql * @covers ::loadJson * @covers ::loadTxt * * @param string $fixtureName * @param string $expMsg */ public function test_loadFixtureFileErr($fixtureName, $expMsg) { // When try { $this->fixtureLoader->loadFixtureData($fixtureName); $thrown = false; $gotMessage = ''; } catch (\Exception $e) { $thrown = true; $gotMessage = $e->getMessage(); } // Then $this->assertTrue($thrown); $this->assertSame($expMsg, $gotMessage); }
/** * @dataProvider loadFixtureFileErrProvider * * @covers ::loadFixtureData * @covers ::loadSql * * @param string $fixtureName * @param string $expMsg */ public function test_loadFixtureFileErr($fixtureName, $expMsg) { // When try { $this->fixtureLoader->loadFixtureData($fixtureName); $thrown = false; $gotMessage = ''; } catch (\Exception $e) { $thrown = true; $gotMessage = $e->getMessage(); // Make path relative to FIXTURE_PATH $gotMessage = str_replace($this->fixturesRootPath . DIRECTORY_SEPARATOR, '', $gotMessage); } // Then $this->assertTrue($thrown); $this->assertSame($expMsg, $gotMessage); }