public function testYAMLParserReadsNewUpFileNameCollectionsCorrectly() { $p = $this->getYAMLParser(); $p->trimArrayValues(true); $parsedValue = $p->parseFile(getFixturePath('Configuration/Parsers/yaml_filenames.yaml')); $this->assertEquals(['ServiceProvider.php' => '{% if (1 == 1) %} hello world {% endif %}', 'ServiceProvider2.php' => '{{ "test_stuff"|studly }}'], $parsedValue); }
public function testPackageFromFileSetsDataCorrectly() { $package = Package::fromFile(getFixturePath('Package/composer.json')); $this->assertEquals($package->getVendor(), 'vendor'); $this->assertEquals($package->getPackage(), 'package'); $this->assertEquals($package->getDescription(), 'An example'); $this->assertEquals($package->getLicense(), 'MIT'); $this->assertCount(1, $package->getAuthors()); }
public function testLoadedPackageClassMethodsCanBeCalledNormally() { $packageLoader = new PackageLoader(new Filesystem()); $className = $packageLoader->loadPackage(getFixturePath('Package/TestPackage')); $package = new $className(); $anotherClass = new \Newup\Test\SimplyAClass(); $nestedClass = new \Newup\Test\Nested\NestedClass(); $this->assertEquals("Hello, World!", $package->getPackageName()); $this->assertEquals("Well, hello there!", $anotherClass->hi()); $this->assertEquals("Sad to see you go!", $nestedClass->goodbye()); }
public function testFileNameCollectorBuildsTheCorrectArray() { $c = $this->getCollector(); $p = $this->getYamlParser(); $c->addFileNames($p->parseFile(getFixturePath('Configuration/Parsers/yaml_filenames.yaml'))); $c->addFileNames(['sample' => 'filename']); $pathNames = $c->collect(); $this->assertInternalType('array', $pathNames); $this->assertCount(1, $pathNames); $this->assertArrayHasKey('sys_pathNames', $pathNames); $actualPathNames = $pathNames['sys_pathNames']; $this->assertCount(3, $actualPathNames); $this->assertArrayHasKey('sample', $actualPathNames); $this->assertArrayHasKey('ServiceProvider.php', $actualPathNames); $this->assertArrayHasKey('ServiceProvider2.php', $actualPathNames); }
/** * Returns the content of a given fixture file. * * @param $file * @return string */ function loadFixtureContent($file) { return normalize_line_endings(file_get_contents(getFixturePath($file))); }
public function getRendererWithTestTemplates() { $r = $this->getRenderer(); $r->addPath(getFixturePath('Templates')); return $r; }
public function testScopeIncludeDoesNotHaveAccessToCurrentClass() { $results = scope_include(getFixturePath('Support/unsafe_scoped_include.php')); // Results will be true when included normally. $this->assertNull($results); }