mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
feat: Add PHP version module (#244)
This commit is contained in:
committed by
Matan Kushner
parent
78ca70a517
commit
46904e5045
@@ -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
|
||||
|
||||
@@ -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(())
|
||||
}
|
||||
Reference in New Issue
Block a user