/** * calling from application will trigger execution */ public function testCallingFromApplicationWillTriggerExecution() { $application = new \MySQLExtractor\Application(); $application->processServer($this->mysqlCredentials); $helper = new \PHPUnitProtectedHelper($application); $extractor = $helper->getValue('extractor'); $databases = $extractor->databases(); $this->assertEquals(1, count($databases)); // will filter based on the mysqlCredentials->dbname $this->assertInstanceOf('\\MySQLExtractor\\Presentation\\Database', $databases['database1']); }
/** * when pdo connection is not mocked then throw PDOException if invalid host */ public function testWhenPDOConnectionIsNotMockedThenThrowPDOExceptionIfInvalidHost() { $systemMockHelper = new \PHPUnitProtectedHelper(new System()); $systemMockHelper->setValue('mock', null); try { $object = new Server($this->mysqlCredentials); $this->fail(); } catch (\PDOException $e) { $message = $e->getMessage(); $this->assertNotEmpty($message); } }