本文整理汇总了PHP中Webmozart\Expression\Expr::notsame方法的典型用法代码示例。如果您正苦于以下问题:PHP Expr::notsame方法的具体用法?PHP Expr::notsame怎么用?PHP Expr::notsame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webmozart\Expression\Expr
的用法示例。
在下文中一共展示了Expr::notsame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMatch
public function testMatch()
{
$packageFile = new PackageFile('vendor/name');
$package = new Package($packageFile, __DIR__);
$this->assertFalse($package->match(Expr::same('foobar', Package::NAME)));
$this->assertTrue($package->match(Expr::same('vendor/name', Package::NAME)));
$this->assertFalse($package->match(Expr::same('/path/foo', Package::INSTALL_PATH)));
$this->assertTrue($package->match(Expr::same(__DIR__, Package::INSTALL_PATH)));
$this->assertFalse($package->match(Expr::same(PackageState::NOT_LOADABLE, Package::STATE)));
$this->assertTrue($package->match(Expr::same(PackageState::ENABLED, Package::STATE)));
$this->assertFalse($package->match(Expr::same('webmozart', Package::INSTALLER)));
// Packages without install info (= the root package) are assumed to be
// installed in the production environment
$this->assertTrue($package->match(Expr::same(Environment::PROD, Package::ENVIRONMENT)));
$installInfo = new InstallInfo('vendor/install-info', '/path');
$installInfo->setInstallerName('webmozart');
$packageWithInstallInfo = new Package($packageFile, __DIR__, $installInfo);
$this->assertFalse($packageWithInstallInfo->match(Expr::same('foobar', Package::INSTALLER)));
$this->assertTrue($packageWithInstallInfo->match(Expr::same('webmozart', Package::INSTALLER)));
$this->assertTrue($packageWithInstallInfo->match(Expr::notsame(Environment::DEV, Package::ENVIRONMENT)));
$installInfo2 = new InstallInfo('vendor/install-info', '/path');
$installInfo2->setEnvironment(Environment::DEV);
$packageWithInstallInfo2 = new Package($packageFile, __DIR__, $installInfo2);
$this->assertTrue($packageWithInstallInfo2->match(Expr::same(Environment::DEV, Package::ENVIRONMENT)));
}