Exemplo n.º 1
0
 /**
  * Test the interpolator will correctly interpolate a string when
  * using a namespace and class name.
  *
  * @test
  */
 public function it_should_be_able_to_interpolate_a_string_using_a_namespace_and_class_name()
 {
     $attachment = $this->build_mock_attachment($this->interpolator, 'Foo\\Faz\\Baz\\TestModel');
     $input = '/system/:namespace/:class_name/:attachment/:id_partition/:style/:filename';
     $interpolatedString = $this->interpolator->interpolate($input, $attachment, 'thumbnail');
     $this->assertEquals('/system/Foo/Faz/Baz/TestModel/photos/000/000/001/thumbnail/test.jpg', $interpolatedString);
 }
 /**
  * Test the interpolator will correctly interpolate a string when
  * using an id partition
  *
  * @test
  * @return void
  */
 public function it_should_be_able_to_interpolate_a_string_using_an_id_partition()
 {
     $input = '/system/:class/:attachment/:id_partition/:style/:filename';
     $interpolatedString = $this->interpolator->interpolate($input, $this->attachment, 'thumbnail');
     $this->assertEquals('/system/TestModel/photos/000/000/001/thumbnail/test.jpg', $interpolatedString);
 }
 /**
  * Merge some interpolation to default
  * @return array
  */
 protected function interpolations()
 {
     $parentInterpolations = parent::interpolations();
     return array_merge($parentInterpolations, [':filename_slugify' => 'filenameSlugify', ':class_lower' => 'getClassLower', ':class_name_lower' => 'getClassNameLower', ':namespace_lower' => 'getNamespaceLower']);
 }