Skip to content

Instantly share code, notes, and snippets.

@tuki0918
Last active January 4, 2016 13:59
Show Gist options
  • Save tuki0918/8631225 to your computer and use it in GitHub Desktop.
Save tuki0918/8631225 to your computer and use it in GitHub Desktop.
jenkins for phpunit memo. buid.xml ant
<project name="jenkins project" default="build">
<target name="phpunit">
<exec dir="." executable="phpunit" failonerror="true">
<arg line="--colors tests" />
</exec>
</target>
<target name="build" depends="phpunit"/>
</project>

Jenkinsの管理


システムの設定


グローバル プロパティ

[ + ] 環境変数

キー:PATH

値:${PATH}:/usr/local/bin

jenkins側でPATHが通っていない場合がある

Jenkinsの位置

Jenkins URL

http://hostname.com/

プラグインの管理


  • AnsiColor
    • コンソールの出力を色付け

project name: jenkins_test

ソースコード管理

[email protected]:tuki0918/jenkins_test.git

ビルド・トリガ

[ + ] SCMをポーリング

ビルド環境

[ + ] Color ANSI Console Output ANSI color map [css]

Antの呼び出し

使用するAnt [ant]

// tests/sample1Test.php
<?php
class Sample1Test extends PHPUnit_Framework_TestCase
{
public function testPushAndPop()
{
$user = array();
$this->assertEquals(0, count($user));
array_push($user, 'hoge');
$this->assertEquals('hoge', $user[0]);
$this->assertEquals(1, count($user));
$this->assertEquals('hoge', array_pop($user));
$this->assertEquals(0, count($user));
}
public function testArray1()
{
$array = array();
$this->assertEquals(0, count($array));
}
public function testArray2()
{
$array = array();
$this->assertEquals(0, count($array));
}
public function testArray3()
{
$array = array(1, 2, 3);
$this->assertEquals(3, count($array));
}
}
@tuki0918
Copy link
Author

tests/*Test.php

フォルダ「tests」以下のファイル「*Test.php」が実行される。

@tuki0918
Copy link
Author

jenkins から github にアクセス必須

@tuki0918
Copy link
Author

jenkins文字化け?
libAlexandrina.so.tDiary(2013-05-07) : http://blog.phalanxware.com/20130507.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment