Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed Console/Command/Task/empty
Empty file.
Empty file removed Controller/Component/empty
Empty file.
Empty file removed Lib/empty
Empty file.
2 changes: 1 addition & 1 deletion Model/Behavior/AvatarBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function createAvatarAutomatically(Model $model, $user) {
$draw->setFontSize(140);

//テキストを追加します
$draw->setFont(CakePlugin::path($model->plugin) . 'webroot' . DS . 'fonts' . DS . 'ipag.ttf');
$draw->setFont(CakePlugin::path($model->plugin) . 'webroot' . DS . 'fonts' . DS . 'ipaexg.ttf');
$draw->annotation(19, 143, mb_substr(mb_convert_kana($user['User']['handlename'], 'KVA'), 0, 1));

//新しいキャンバスオブジェクトを作成する
Expand Down
Empty file removed Model/Behavior/empty
Empty file.
Empty file removed Model/Datasource/empty
Empty file.
25 changes: 25 additions & 0 deletions Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,31 @@ public function createUser() {
return $results;
}

/**
* Userの存在チェック
*
* @param int|array $userId ユーザID
* @return bool True:正常、False:不正
*/
public function existsUser($userId) {
if (! $userId) {
return false;
}

if (! is_array($userId)) {
$userId = (array)$userId;
}

$count = $this->find('count', array(
'recursive' => -1,
'conditions' => array(
$this->alias . '.id' => $userId
),
));

return count($userId) === $count;
}

/**
* Userの取得
*
Expand Down
2 changes: 1 addition & 1 deletion Test/Case/AllUsersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AllUsersTest extends NetCommonsTestSuite {
public static function suite() {
$plugin = preg_replace('/^All([\w]+)Test$/', '$1', __CLASS__);
$suite = new NetCommonsTestSuite(sprintf('All %s Plugin tests', $plugin));
//$suite->addTestDirectoryRecursive(CakePlugin::path($plugin) . 'Test' . DS . 'Case');
$suite->addTestDirectoryRecursive(CakePlugin::path($plugin) . 'Test' . DS . 'Case');
return $suite;
}
}
70 changes: 0 additions & 70 deletions Test/Case/Controller/UsersControllerTest.php

This file was deleted.

64 changes: 0 additions & 64 deletions Test/Case/Controller/UsersControllerTestBase.php

This file was deleted.

90 changes: 90 additions & 0 deletions Test/Case/Model/User/ExistsUserTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php
/**
* User::existsUser()のテスト
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/

App::uses('NetCommonsModelTestCase', 'NetCommons.TestSuite');

/**
* User::existsUser()のテスト
*
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @package NetCommons\Users\Test\Case\Model\User
*/
class UserExistsUserTest extends NetCommonsModelTestCase {

/**
* Fixtures
*
* @var array
*/
public $fixtures = array(
'plugin.users.user',
'plugin.users.user_select_count',
'plugin.users.users_language',
);

/**
* Plugin name
*
* @var string
*/
public $plugin = 'users';

/**
* Model name
*
* @var string
*/
protected $_modelName = 'User';

/**
* Method name
*
* @var string
*/
protected $_methodName = 'existsUser';

/**
* Delete用DataProvider
*
* ### 戻り値
* - userId ユーザID
* - expected 期待値
*
* @return array テストデータ
*/
public function dataProvider() {
return array(
array('userId' => null, 'expected' => false),
array('userId' => '1', 'expected' => true),
array('userId' => array('1', '3'), 'expected' => true),
array('userId' => array('1', '99'), 'expected' => false),
);
}

/**
* existsUser()のテスト
*
* @param int|array $userId ユーザID
* @param bool $expected 期待値
* @dataProvider dataProvider
* @return void
*/
public function testExistsUser($userId, $expected) {
//テスト実施
$model = $this->_modelName;
$methodName = $this->_methodName;
$result = $this->$model->$methodName($userId);

//チェック
$this->assertEquals($expected, $result);
}

}
112 changes: 0 additions & 112 deletions Test/Case/Model/UserTest.php

This file was deleted.

Loading