当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorOwnersPackage::findLongestPathsPerPackage方法代码示例

本文整理汇总了PHP中PhabricatorOwnersPackage::findLongestPathsPerPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorOwnersPackage::findLongestPathsPerPackage方法的具体用法?PHP PhabricatorOwnersPackage::findLongestPathsPerPackage怎么用?PHP PhabricatorOwnersPackage::findLongestPathsPerPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorOwnersPackage的用法示例。


在下文中一共展示了PhabricatorOwnersPackage::findLongestPathsPerPackage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testFindLongestPathsPerPackage

 function testFindLongestPathsPerPackage()
 {
     $rows = array(array('id' => 1, 'excluded' => 0, 'path' => 'src/'), array('id' => 1, 'excluded' => 1, 'path' => 'src/releeph/'), array('id' => 2, 'excluded' => 0, 'path' => 'src/releeph/'));
     $paths = array('src/' => array('src/a.php' => true, 'src/releeph/b.php' => true), 'src/releeph/' => array('src/releeph/b.php' => true));
     $this->assertEqual(array(1 => strlen('src/'), 2 => strlen('src/releeph/')), PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths));
     $paths = array('src/' => array('src/releeph/b.php' => true), 'src/releeph/' => array('src/releeph/b.php' => true));
     $this->assertEqual(array(2 => strlen('src/releeph/')), PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:8,代码来源:PhabricatorOwnersPackageTestCase.php

示例2: testFindLongestPathsPerPackage

 public function testFindLongestPathsPerPackage()
 {
     $rows = array(array('id' => 1, 'excluded' => 0, 'dominion' => PhabricatorOwnersPackage::DOMINION_STRONG, 'path' => 'src/'), array('id' => 1, 'excluded' => 1, 'dominion' => PhabricatorOwnersPackage::DOMINION_STRONG, 'path' => 'src/releeph/'), array('id' => 2, 'excluded' => 0, 'dominion' => PhabricatorOwnersPackage::DOMINION_STRONG, 'path' => 'src/releeph/'));
     $paths = array('src/' => array('src/a.php' => true, 'src/releeph/b.php' => true), 'src/releeph/' => array('src/releeph/b.php' => true));
     $this->assertEqual(array(1 => strlen('src/'), 2 => strlen('src/releeph/')), PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths));
     $paths = array('src/' => array('src/releeph/b.php' => true), 'src/releeph/' => array('src/releeph/b.php' => true));
     $this->assertEqual(array(2 => strlen('src/releeph/')), PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths));
     // Test packages with weak dominion. Here, only package #2 should own the
     // path. Package #1's claim is ceded to Package #2 because it uses weak
     // rules. Package #2 gets the claim even though it also has weak rules
     // because there is no more-specific package.
     $rows = array(array('id' => 1, 'excluded' => 0, 'dominion' => PhabricatorOwnersPackage::DOMINION_WEAK, 'path' => 'src/'), array('id' => 2, 'excluded' => 0, 'dominion' => PhabricatorOwnersPackage::DOMINION_WEAK, 'path' => 'src/applications/'));
     $pvalue = array('src/applications/main/main.c' => true);
     $paths = array('src/' => $pvalue, 'src/applications/' => $pvalue);
     $this->assertEqual(array(2 => strlen('src/applications/')), PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths));
     // Now, add a more specific path to Package #1. This tests nested ownership
     // in packages with weak dominion rules. This time, Package #1 should end
     // up back on top, with Package #2 cedeing control to its more specific
     // path.
     $rows[] = array('id' => 1, 'excluded' => 0, 'dominion' => PhabricatorOwnersPackage::DOMINION_WEAK, 'path' => 'src/applications/main/');
     $paths['src/applications/main/'] = $pvalue;
     $this->assertEqual(array(1 => strlen('src/applications/main/')), PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths));
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:23,代码来源:PhabricatorOwnersPackageTestCase.php


注:本文中的PhabricatorOwnersPackage::findLongestPathsPerPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。