Ejemplo n.º 1
0
 function test_create_customFactoryContainer()
 {
     $expectedTestDbAcle = new \TestDbAcle\TestDbAcle();
     $mockPdo = \TestDbAcle\PhpUnit\Mocks\MockablePdo::createMock($this, array('getAttribute'));
     $mockPdo->expects($this->once())->method('getAttribute')->with(\PDO::ATTR_DRIVER_NAME)->will($this->returnValue("mysql"));
     $expectedConfig = array('foo' => function () {
         return "moo";
     });
     $factories = \Mockery::mock('\\TestDbAcle\\Config\\FactoriesInterface');
     $factories->shouldReceive("getFactories")->with("mysql")->andReturn($expectedConfig);
     $serviceLocator = new \TestDbAcle\ServiceLocator($expectedConfig);
     $serviceLocator->setService('pdo', $mockPdo);
     $expectedTestDbAcle->setServiceLocator($serviceLocator);
     $testDbAcle = \TestDbAcle\TestDbAcle::create($mockPdo, array(), $factories);
     $this->assertEquals($expectedTestDbAcle, $testDbAcle);
 }
Ejemplo n.º 2
0
 /**
  * used to create the TestDbAcle database helper
  * @return \TestDbAcle\TestDbAcle
  */
 protected function createDatabaseTestHelper()
 {
     return \TestDbAcle\TestDbAcle::create($this->getPdo());
 }