/** * @dataProvider provideOk */ public function testOk($zephir, $namespace, $class) { $sUT = new ZephirClassInfo(); $zephirClassInfoDto = $sUT->getZephirCodeInfo($zephir); $this->assertInstanceOf('ZephirTestCase\\ZephirClassInfoDto', $zephirClassInfoDto); $expected = new ZephirClassInfoDto(); $expected->setNamespace($namespace); $expected->setClassName($class); $this->assertEquals($expected, $zephirClassInfoDto); }
/** * Build a zephir extension and return the extension path * * @param string $zephir * @param boolean $silent * @throws \Exception * @return string */ public function build($zephir, $silent) { $dto = $this->zephirClassInfo->getZephirCodeInfo($zephir); $this->fileWorker->writeZephirFile($dto, $zephir); $this->defineZephirHome(); try { $config = new Config(); $config->set('namespace', $dto->getExtensionName()); $config->set('silent', $silent); if (is_dir('ext')) { $this->commandFullClean->execute($config, new ZephirLogger($config)); } $this->commandBuild->execute($config, new ZephirLogger($config)); } catch (\Exception $e) { $this->fileWorker->rmdirRecursive($dto->getBaseDir()); throw new \Exception(sprintf('Error on %s', $e->getMessage())); } return 'ext/modules/' . $dto->getExtensionName() . '.so'; }