Files
piratepoet/tests/DataFactories/Segment.php
Pavel Dohnal fd72756622 Add Segment data factory
[MAILPOET-1546]
2018-10-02 08:56:43 +02:00

49 lines
814 B
PHP

<?php
namespace MailPoet\Test\DataFactories;
use Carbon\Carbon;
class Segment {
private $data;
public function __construct() {
$this->data = [
'name' => 'List ' . uniqid(),
];
}
/**
* @param string $name
* @return $this
*/
public function withName($name) {
$this->data['name'] = $name;
return $this;
}
/**
* @param string $description
* @return $this
*/
public function withDescription($description) {
$this->data['description'] = $description;
return $this;
}
/**
* @return $this
*/
public function withDeleted() {
$this->data['deleted_at'] = Carbon::now();
return $this;
}
/** @return \MailPoet\Models\Segment */
public function create() {
return \MailPoet\Models\Segment::createOrUpdate($this->data);
}
}