Пример #1
0
 /**
  * @covers ::newRepo
  * @covers ::setConfigClass
  */
 public function testNewRepo()
 {
     $repo = Container::newRepo('Harp\\Harp\\Test\\TestModel\\City');
     $this->assertInstanceOf('Harp\\Harp\\Repo', $repo);
     $this->assertInstanceOf('Harp\\Harp\\Config', $repo->getConfig());
     $this->assertEquals('Harp\\Harp\\Test\\TestModel\\City', $repo->getModelClass());
     Container::setConfigClass('Harp\\Harp\\Test\\Repo\\TestConfig');
     $repo = Container::newRepo('Harp\\Harp\\Test\\TestModel\\City');
     $this->assertInstanceOf('Harp\\Harp\\Repo', $repo);
     $this->assertInstanceOf('Harp\\Harp\\Test\\Repo\\TestConfig', $repo->getConfig());
     $this->setExpectedException('InvalidArgumentException', 'Config class Harp\\Harp\\Test\\TestModel\\City must be a subclass of Harp\\Harp\\Config');
     Container::setConfigClass('Harp\\Harp\\Test\\TestModel\\City');
 }