feat: Add PHP version module (#244)

This commit is contained in:
Stephen Ball
2019-12-05 18:04:27 +00:00
committed by Matan Kushner
parent 78ca70a517
commit 46904e5045
10 changed files with 191 additions and 0 deletions
+12
View File
@@ -61,6 +61,18 @@ RUN mkdir -p "$DOTNET_HOME" \
ENV PATH $DOTNET_HOME:$PATH
RUN dotnet help
# Install PHP
ENV PHP_VERSION 7.3.8
ENV PHPENV_ROOT /home/nonroot/.phpenv
ENV PATH $PHPENV_ROOT/bin:$PHPENV_ROOT/shims:$PATH
ENV CONFIGURE_OPTS "--without-tidy --disable-zip"
RUN curl -L https://raw.githubusercontent.com/phpenv/phpenv-installer/master/bin/phpenv-installer | bash \
&& phpenv install $PHP_VERSION \
&& phpenv global $PHP_VERSION \
&& chmod -R a+x $PHPENV_ROOT
# Check that PHP was correctly installed
RUN php --version
# Install Mercurial
RUN HGPYTHON3=1 pip install mercurial
# Check that Mercurial was correctly installed
+56
View File
@@ -0,0 +1,56 @@
use std::fs::File;
use std::io;
use ansi_term::Color;
use crate::common;
use crate::common::TestCommand;
#[test]
fn folder_without_php_files() -> io::Result<()> {
let dir = common::new_tempdir()?;
let output = common::render_module("php")
.arg("--path")
.arg(dir.path())
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = "";
assert_eq!(expected, actual);
Ok(())
}
#[test]
#[ignore]
fn folder_with_composer_file() -> io::Result<()> {
let dir = common::new_tempdir()?;
File::create(dir.path().join("composer.json"))?;
let output = common::render_module("php")
.arg("--path")
.arg(dir.path())
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = format!("via {} ", Color::Red.bold().paint("🐘 v7.3.8"));
assert_eq!(expected, actual);
Ok(())
}
#[test]
#[ignore]
fn folder_with_php_file() -> io::Result<()> {
let dir = common::new_tempdir()?;
File::create(dir.path().join("any.php"))?;
let output = common::render_module("php")
.arg("--path")
.arg(dir.path())
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = format!("via {} ", Color::Red.bold().paint("🐘 v7.3.8"));
assert_eq!(expected, actual);
Ok(())
}