protected function buildContributable() { $urlFactory = new tubepress_url_impl_puzzle_UrlFactory(); $authors = array(array('name' => 'author name', 'url' => $urlFactory->fromString('http://author.com/foo')), array('name' => 'other author name', 'email' => '*****@*****.**')); $licenses = array('urls' => array($urlFactory->fromString('http://license.com/text.html')), 'type' => 'some license type'); return $this->buildSut('some-name', tubepress_api_version_Version::parse('1.2.3'), 'some title', $authors, $licenses); }
public function __construct(tubepress_api_url_UrlFactoryInterface $urlFactory, tubepress_api_boot_BootSettingsInterface $bootSettings) { $this->_urlFactory = $urlFactory; $this->_bootSettings = $bootSettings; $this->_properties = new tubepress_internal_collection_Map(); $this->_properties->put(self::$_PROPERTY_VERSION, tubepress_api_version_Version::parse('99.99.99')); $this->_properties->put(self::$_PROPERTY_IS_PRO, false); }
public function testVersion() { $this->_sut = new tubepress_environment_impl_Environment($this->_mockUrlFactory, $this->_mockBootSettings); $latest = tubepress_api_version_Version::parse('99.99.99'); $current = $this->_sut->getVersion(); $this->assertTrue($current instanceof tubepress_api_version_Version); $this->assertTrue($latest->compareTo($current) === 0, "Expected {$latest} but got {$current}"); }
/** * @dataProvider trueAndFalse */ public function testExistInParent($exists) { $this->_mockCurrentThemeService->shouldReceive('getCurrentTheme')->twice()->andReturn($this->_mockChildTheme); $this->_mockChildTheme->shouldReceive('hasTemplateSource')->twice()->with('template-name')->andReturn(false); $this->_mockChildTheme->shouldReceive('getParentThemeName')->twice()->andReturn('xyz'); $this->_mockChildTheme->shouldReceive('getName')->atLeast(1)->andReturn('abc'); $this->_mockChildTheme->shouldReceive('getVersion')->twice()->andReturn('1.2.3'); $this->_mockThemeRegistry->shouldReceive('getInstanceByName')->with('xyz')->andReturn($this->_mockParentTheme); $this->_mockParentTheme->shouldReceive('hasTemplateSource')->twice()->with('template-name')->andReturn($exists); $this->_mockChildTheme->shouldReceive('getVersion')->atLeast(1)->andReturn(tubepress_api_version_Version::parse('1.2.3')); if (!$exists) { $this->_mockParentTheme->shouldReceive('getParentThemeName')->twice()->andReturnNull(); $this->_mockParentTheme->shouldReceive('getName')->twice()->andReturn('parent-theme-name'); } else { $this->_mockParentTheme->shouldReceive('getName')->atLeast(1)->andReturn('xyz'); $this->_mockParentTheme->shouldReceive('getVersion')->atLeast(1)->andReturn('3.2.1'); } $this->assertTrue($this->_sut->exists('template-name') === $exists); $this->assertTrue($this->_sut->exists('template-name') === $exists); }
public function testGettersNoQualifier() { $version = new tubepress_api_version_Version('3', '2', '1'); $this->assertTrue(3 === $version->getMajor()); $this->assertTrue(2 === $version->getMinor()); $this->assertTrue(1 === $version->getMicro()); $this->assertTrue(null === $version->getQualifier()); }
private function _handleVersion(array &$manifestData, array &$errors) { $key = self::$FIRST_LEVEL_KEY_VERSION; if (!isset($manifestData[$key])) { $errors[] = 'Missing version'; return; } $candidate = $manifestData[$key]; if ($candidate instanceof tubepress_api_version_Version) { return; } if (!$candidate) { $errors[] = 'Empty version'; return; } try { $manifestData[$key] = tubepress_api_version_Version::parse($candidate); } catch (InvalidArgumentException $e) { $errors[] = 'Malformed version'; } }