protected function assertCliCommandEquals($expected, $actual) { if (strpos(PHP_OS, 'WIN') !== false) { $expected = Helper::normalizeEscapeShellArg($expected); } $this->assertEquals($expected, $actual); }
public function testRepositoryOpenOnSubPathOfRepositoryPath() { Helper::createDirectory(TESTS_REPO_PATH_1 . '/test'); $c = $this->getRepository(TESTS_REPO_PATH_1 . '/test'); $this->assertInstanceOf('TQ\\Svn\\Repository\\Repository', $c); $this->assertEquals(TESTS_REPO_PATH_1, $c->getRepositoryPath()); }
public function testGetContentsOfDirectory() { $c = $this->getRepository(); $dir = sprintf('git://%s', TESTS_REPO_PATH_1); $this->assertEquals(Helper::normalizeNewLines("tree HEAD:\n\nfile_0.txt\nfile_1.txt\nfile_2.txt\nfile_3.txt\nfile_4.txt"), Helper::normalizeNewLines(file_get_contents($dir))); $c->removeFile('file_0.txt'); $c->renameFile('file_1.txt', 'file_x.txt'); $this->assertEquals(Helper::normalizeNewLines("tree HEAD:\n\nfile_2.txt\nfile_3.txt\nfile_4.txt\nfile_x.txt"), Helper::normalizeNewLines(file_get_contents($dir))); $this->assertEquals(Helper::normalizeNewLines("tree HEAD^:\n\nfile_1.txt\nfile_2.txt\nfile_3.txt\nfile_4.txt"), Helper::normalizeNewLines(file_get_contents($dir . '#HEAD^'))); $this->assertEquals(Helper::normalizeNewLines("tree HEAD^^:\n\nfile_0.txt\nfile_1.txt\nfile_2.txt\nfile_3.txt\nfile_4.txt"), Helper::normalizeNewLines(file_get_contents($dir . '#HEAD^^'))); }
/** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. */ protected function tearDown() { Helper::removeDirectory(TESTS_TMP_PATH); }
/** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. */ protected function tearDown() { Helper::removeDirectory(TESTS_TMP_PATH); StreamWrapper::unregister(); }
* of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/TQ/Tests/Helper.php'; use TQ\Tests\Helper; define('PROJECT_PATH', Helper::normalizeDirectorySeparator(dirname(__DIR__))); define('SOURCE_PATH', PROJECT_PATH . '/src'); define('TESTS_PATH', Helper::normalizeDirectorySeparator(__DIR__)); if (defined('TEST_REPO_PATH') && is_string(TEST_REPO_PATH)) { define('TESTS_TMP_PATH', Helper::normalizeDirectorySeparator(TEST_REPO_PATH) . '/_tq_git_streamwrapper_tests'); } else { define('TESTS_TMP_PATH', Helper::normalizeDirectorySeparator(sys_get_temp_dir()) . '/_tq_git_streamwrapper_tests'); } define('TESTS_REPO_PATH_1', TESTS_TMP_PATH . '/repo1'); define('TESTS_REPO_PATH_2', TESTS_TMP_PATH . '/repo2'); define('TESTS_REPO_PATH_3', TESTS_TMP_PATH . '/repo3');