/** * Creates a journal entry. * * The entry can be created from an operation. * * @param Operation|mixed $properties * @param array $construct_args * @param string $class_name * * @return Entry */ public static function from($properties = null, array $construct_args = array(), $class_name = null) { if ($properties instanceof Operation) { return static::from_operation($properties, $construct_args = array()); } return parent::from($properties, $construct_args, $class_name); }
public function test_with_our_resolver() { $resolver = self::$resolver; $record = ActiveRecord::from(['uid' => 0], ['dummy']); $this->assertNotEmpty($resolver(self::$admin_user, $record)); $this->assertEmpty($resolver(self::$simple_user, $record)); $this->assertEmpty($resolver(self::$guest_user, $record)); $record = ActiveRecord::from(['uid' => 1], ['dummy']); $this->assertNotEmpty($resolver(self::$admin_user, $record)); $this->assertEmpty($resolver(self::$simple_user, $record)); $this->assertEmpty($resolver(self::$guest_user, $record)); $record = ActiveRecord::from(['uid' => 2], ['dummy']); $this->assertNotEmpty($resolver(self::$admin_user, $record)); $this->assertNotEmpty($resolver(self::$simple_user, $record)); $this->assertEmpty($resolver(self::$guest_user, $record)); $record = ActiveRecord::from(['uid' => 123], ['dummy']); $this->assertNotEmpty($resolver(self::$admin_user, $record)); $this->assertEmpty($resolver(self::$simple_user, $record)); $this->assertEmpty($resolver(self::$guest_user, $record)); }