/** * 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 constructor is called then initialize the PDO object using the input credentials */ public function testWhenConstructorIsCalledthenInitializeThePDOObjectUsingTheInputCredentials() { $PDOMock = \Mockery::mock('\\PDO')->makePartial(); $systemMock = \Mockery::mock('\\MySQLExtractor\\SystemMock')->makePartial(); $systemMock->shouldReceive('getPDO')->with($this->mysqlCredentials)->andReturn($PDOMock); $systemMockHelper = new \PHPUnitProtectedHelper(new System()); $systemMockHelper->setValue('mock', $systemMock); $object = new Server($this->mysqlCredentials); $objectHelper = new \PHPUnitProtectedHelper($object); $this->assertSame($PDOMock, $objectHelper->getValue('PDO')); }